find and replace

Started by raymw, September 28, 2019, 09:55:04 AM

Previous topic - Next topic

SeaVipe

Hi Ray,
Here are the results after a bit of fiddling...


I changed the thickness of the line from 3 to 1.


Note that the caption for frmMain is "XfrmMain" but only the "X" is displayed.
frmMain Events: Load, FormClosed
Also, 6 compiler Warnings that with a little research I should be able to get rid of.
Here are the compiler switches I have set: -g -exx -w Pedantic -w Escape -w Next -w 0 -w All (probably not the best way to set compiler switches)
Clive Richey

raymw

Thanks Clive,
I'll poke at it some more. Presumably you didn't test on 1.93? . Not sure whether that may help, because I guess Paul tests on whatever version of winfbe he is developing at the time, and he's just released another one..

SeaVipe

#17
Hi Ray, I used 1.9.3 (the most recent - C:\WinFBE_Suite\FreeBASIC-1.07.1-gcc-5.2\fbc64.exe), 64Bit, Win64 Console (debug).
Successfully compilled using WinFBE 1.9.2 although it thew 2 more compiler warnings.
Clive Richey

raymw

What you got to do, a duh moment, pointed out to me by Paul - is you have to set the form properties to load and close. So flipping obvious when you know.

Thanks Paul, again  :D

raymw

Right, almost there, but I'm finding that often the border styles for the forms or list boxes appear to randomly change to a non-valid type for that particular control. I reset it in the designer properties, it then compiles, until the next time, it is happening rather frequently.

Paul Squires

Quote from: raymw on October 03, 2019, 09:34:54 PM
Right, almost there, but I'm finding that often the border styles for the forms or list boxes appear to randomly change to a non-valid type for that particular control. I reset it in the designer properties, it then compiles, until the next time, it is happening rather frequently.
Interesting that you'd say that because eary in the visual designer development I would notice this as well. I implemented a fix and it seemed to had worked, but if you're seeing it then I better investigate more. It is related to a got/lost focus issue when the user moves from control to control.
Paul Squires
PlanetSquires Software

raymw

Hi Paul,

I just thought I'd show some of the effects I get with my programmatically generated spiral g-code. This is not what it is about, but the results are sort of pretty, if you like spikey things. A week or two ago, I was running the 2D gcode produced by my c# program, (written about 4 years ago) through a fb file, to pull it apart and add in the z coordinates. Now, I've translated the c# into fb, and added in my 3d stuff. The pictures are not 3d, merely varied the black pen colour values as each line drawn. I'm well pleased. Flying through rocks comes later.

(btw, found another very minor issue, easily solved - labels in designer. In the designer, all the characters show, but if nearly filling the label box, it is truncated in the label when form is loaded e.g. 'number points', originally, but truncated to 'number' .It seems the label size varies between design and run - simple enough to drag it a bit bigger in the designer.)

Thanks for your patience.




Paul Squires

The truncation could be due to having another control overlapping the end of the label? The zorder could be different between designer view and runtime depending on the order in which the controls are created.
Paul Squires
PlanetSquires Software

raymw

I don't think it is to do with overlapping, Text is left aligned, and I drag to the right. If it overlapped, the text to right would be obscured, I think. Plenty of space around the labels in designer.
Another puzzling fundamental question for me - Is it possible to send data between forms without writing via textboxes/list/boxes, other elements?  Something like form1.double1 = form2.double2. I can't get variables in a form recognised outside of the form, there is bound to be a simple answer that I can't think of.

SeaVipe

#24
QuoteSomething like form1.double1 = form2.double2.


Like a shared variable?
Clive Richey

raymw

Maybe, . at the moment, I'm using the 'graphics' form (frmmain)to get values from my  spiralform fields. e.g. with code in frmmain like x1 = val(spiralform.xs.SelectedItem.text ) *scale   +xoff
But, I would prefer values to be 'pushed', instead of pulled to the graphics form. Obviously, I can create list boxes on the graphics form, but I'd rather have the graphic's form be more generic, e.g, be able to set something like this in my spiralform code  - frmmain.x1 =  val(spiralform.xs.SelectedItem.text ) *scale  +xoff (and since I'm using in the spiralform xs1 = val(spiralform.xs.selecteditem) then it would make sense after that conversion, to send the value to frmmain as frmmain.xs= spiralform.xs1*scale+xoff. maybe needs to be a set/get or similar.

The intention is to have frmmain (which I will eventually rename - maybe 'plotme') as a standard sort of graphic routine to plot lines. I do not want to alter its code whenever  it needs  values from different forms.

Any help appreciated.

SeaVipe

I sometimes use the Form's Tag property. If I need the Tag string value to be numeric (like a double) then, like your sample code, I use Val().
Clive Richey

raymw

#27
Thanks Clive. I've used textboxes (hidden) but to my mind that is an unnecessary overhead. Still, moving things around as strings will have to do until something more succinct comes to mind.
I thought I could have a shared text box,(dtr.text, say) that the the two forms could access. Looking at it from a master slave communications situation, that the master sends values, the slave sets dtr.text to "stop" the master stops sending, slave processes the data it has received, sets dtr.text to "go", master sends some more. It may work, but not so far. I'll sleep on it.

SeaVipe


Sample of The control's TAG propertyIn frmSettings:


Function frmSettings_btnTest_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   
    Dim as string s = "frmMain.Tag set in frmMain = " + frmMain.Tag + CRLF
    frmMain.Tag = "123"
    s += "frmMain.Tag set in frmSettings = " + frmMain.Tag + CRLF
    s += "frmSettings.Tag set in frmMain = " + str(val(frmSettings.Tag )) + CRLF
    Dim as double d = val(frmSettings.Tag )
    s += "Sqr of frmSettings.Tag = " + Str( sqr(d) )
   
    frmSettings.lblTagDisplay.text = s
   
    Function = 0
End Function


in frmMain:

Function frmMain_btnSettings_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   
    frmSettings.Tag = "54321.1234"   
    frmMain.Tag = "987"
    frmSettings.ShowDialog( frmMain ) ' Modal
    ? "-"; frmMain.Tag
       
    Function = 0
End Function



Output in image:
Clive Richey

raymw

#29
The graphics part is just to give a clue as to what the final machined object will look like. I've created a couple of hidden listboxes in the graphics form, and push the values from my main form to there. It works OK, but I may work on it some more. I'm not sure if I want to print or save the drawing as a separate entity, as opposed to saving the G-code and making the thing. Thought you may be interested.  Machined out of resin for  prototyping. Works OK. A couple of quick phone snaps.