|
Post by xxgeek on May 4, 2023 12:42:40 GMT -5
Close but not quite the same, I made a couple of minor changes as well as set the form default res back to 600x500.
Keep in mind this is written for JB, and it was written to run on my PC without any attempt to correct paths etc for other PC's. You may run into problems and need to edit it.
Also, it now deletes temp .bas files on exit.
|
|
|
Post by Rod on May 6, 2023 7:47:46 GMT -5
This is version1.6 which includes some ability to import and export from .bas files. The .zip will extract to a new folder v1.6, copy example .bas files to that folder to play with, dont risk your actual .bas files just yet! While the idea of opening up any .bas file and adjusting how the form looks seems persuasive I just wonder how many folks actually want to do that? Anyways try this out if you can. There will be many bugs to weed out. gamebin.webs.com/Freeform%20Ultra%20Lite%20v1.6.zip
|
|
|
Post by xxgeek on May 8, 2023 11:36:21 GMT -5
I like the new additions Rod. They are working fairly well too. However there are inconsistencies.
I 'imported' many of the apps(.bas files) I work on here and 'some of them' have all the controls placed where they should be. Others however don't, and usually end up at the far right of the window, instead of in the middle of the window as they are coded to do.
Another thing happening is the app crashes when "preview" button is pushed. Any syntax error in the resulting code (or the code of a selected users bas file)will cause a crash since the compiler catches those errors before displaying the app, just the same as it would if "run" in the IDE manually.
There have been a few different syntax errors in the code created by FFUltra. One is an error in the line to open a window. eg: open "test" for window as #results : resultsOpen = 1 results in a syntax error
open "test" for window as #results : resultsOpen = 1 'both lines are the created code #results : resultsOpen = 1 "trapclose [quit]" 'syntax error here
Also, sometimes when I press "preview", the app crashes with "subscript out of range". Probably to do with code created by FFUltra, but may have been an old bad version of a file of my own. Will check further to determine. I have also noticed many spaces missing in text. A .bas file imported could have a line like : button #main.button1,"Press to Continue",[cont],UL,275,0,60,25 becomes button #main.button1,"PresstoContinue",[cont],UL,275,0,60,25 With spaces removed
I'm not sure if it is worth it Rod, they are great additions though, and being able to import .bas files is a bonus. However it will be a chore to create syntax free code from every possible .bas file a user may try to import. The compiler is unforgiving, and WILL crash the app on syntax, and other errors, since the compiler checks code previous to 'running' it when using the command line options.
Not only will you need to code for user files having bad code, but also for any bad code FFUltra may create.
If anyone can do it Rod, you can. Don't give up. It's a lot better than the other option called FreeForm.
Been busy lately getting my bike running and ready to ride in the good weather. It's a 30 year old Honda, and for the first time it was left out in the cold for the winter. It's mad at me. Got a solar panel charging the battery right now.
Still playing with code at night, and will continue to report whatever I find that seems in need of attention.
|
|
|
Post by Rod on May 8, 2023 13:10:38 GMT -5
Thanks, lots to look at. Parsing a file the app has written is working well. Parsing something a human has written is harder. For example the : separator. Not a fan of it but will need to think about how to cope with it. I take all the spaces out to parse on the , But the original line and spaces should be written back. I have color working but fonts are proving harder since they happen after the window open line. they need passed back to the obj() line. I have used hidden objects to hold color and font change info. It may seem confusing to know what is getting worked, .bas .ffu, but the plan is to make it agnostic and let it load or save or preview whatever is currently in play. But unless you save or write or export current changes they will be lost. but you can save .bas or .ffu as a .ffu and you can write a .bas or a .ffu as a .bas and you can export back to an existing .bas. The core obj() is the glue that holds it all together. save write or export are just actions.
I will keep going for now. What I have planned is to change name to GUI Master and eventually rewrite my button creation program to a more visual Button Master and my sprite creation tool to Sprite Master. So my winter programming is planned and it's only May!
|
|
|
Post by tsh73 on May 8, 2023 13:42:19 GMT -5
Hello I was interested in importing BAS code So is it supposed (in the bright future) to be possible to load program, move some buttons and get working program back?
I tried on some standard JB examples
and I see that JB/LB has WindowWidth/WindowHeight is ?? 320 x 360 (I tested different window types) Import does not has default values set, so it sometimes ends up with window of size 0 x 350
Also it does not know about button corners other then UL - so all buttons read became UL.
Will fiddle with that more.
BITMAP.bas imports ends with message "Bitmap named button1 not found" For now I cludged it with
sub tryDrawbmp bmp$ on error goto [fail] #fful.gb "drawbmp ";bmp$ exit sub [fail] #fful.gb "|" 'empty line #fful.gb "|";bmp$ 'draw name of bitmap instead end sub So it tries to, but if it can't it just prints a name of bmpbutton (I wonder if path to missing BMP wold make it more of use?)
also found that if I create form with BMP BUTTON, save it - it runs
bmpbutton #1.bb2,"tick.bmp",[bb2click], UL, 140,30 but then I import BAS and try to preview I got quotes doubled
bmpbutton #1.bb2,""tick.bmp"",[bb2click], UL, 140,30
Could be fixed in 'find controls and create obj() block by applying deQuote over file name
if w=3 or w=4 or w=6 then obj$(obj,3)=deQuote$(word$(ll$,2,","))
function deQuote$(s$) s$=trim$(s$) if left$(s$,1)=chr$(34) then s$=mid$(s$,2) if right$(s$,1)=chr$(34) then s$=mid$(s$,1,len(s$)-1) deQuote$ = s$ end function
|
|
|
Post by tsh73 on May 8, 2023 14:27:25 GMT -5
While chasing some weird errors (may be of my own making) I found 10 lines
obj(obj,6))=ctrh Extra ")"
|
|
|
Post by xxgeek on May 8, 2023 15:03:08 GMT -5
I believe, at least for now, Rod is only interested in the Form(s) in the .bas files. and working with the entire .bas file to "move buttons and get a working program back" isn't being considered, just the Form. But hey, great idea Anatoly, can't wait for you to write it up
|
|
|
Post by tsh73 on May 8, 2023 15:16:52 GMT -5
so a thing or two I get to know about importing programs with BMP buttons: For buttons to be selectable, program should read BMP and get bitmap size for that
(I actually coped BITMAP.bas to Freeform Ultra Lite v1.6 folder and copied bmp\ folder there)
so end of 'find controls and create obj() became
if w=3 or w=4 or w=6 then obj$(obj,3)=deQuote$(word$(ll$,2,",")) if w=6 then call tryLoadBMP obj obj=obj+1 end if
and tryLoadBMP goes along this (removed extra parts. Most hard found EXTRA was fiddling with DefaultDir)
sub tryLoadBMP obj on error goto [fail] file$ = obj$(obj,3) if file$<>"" then open file$ for input as #bmp 'the bmpfileheader bmp$ = Input$(#bmp,lof(#bmp)) if mid$(bmp$,1,2) ="BM" then 'always BM obj(obj,3)=value(mid$(bmp$,19,4))'width obj(obj,4)=value(mid$(bmp$,23,4))'height obj$(obj,3)=file$ obj$(obj,2)="bmp" call tryUnLoadBMP obj$(obj,1) loadbmp obj$(obj,1),file$ end if close #bmp end if exit sub [fail] 'print "tryLoadBMP failed for ";obj;" ";file$ end sub
sub tryUnLoadBMP bmp$ on error goto [fail] unloadbmp bmp$ [fail] end sub
|
|
|
Post by Rod on May 8, 2023 15:28:54 GMT -5
The primary aim of the program is to create a gui form. That bit works reasonably well. But folks said they might like to rebimport that .bas once created to amend the gui form.
So yes the idea is that you will be able to import the .bas file and amend the position ,color, and fonts of the controls. Also to add new and delete. But not quite there with that.
I don’t propose to touch the bulk of the .bas only the statements which build the form are imported, the rest is left untouched. These imported lines are amended and replaced in the .bas file on export.
It is going to work best importing a file of its own making. But we will see how far I get importing any old file.
It can’t deal with control parameters that are variables. I have color working but fonts are proving a challenge. I will pick off as many bugs you have reported as I can.
Thanks for trying it out.
|
|
|
Post by Rod on May 8, 2023 15:32:28 GMT -5
The code does retrieve the bmp width and height will explain that a bit more tomorrow. The paths thing does need sorted but I have deliberately not introduced paths to force working in the fful directory so as to avoid causing mayhem on testers own systems and files. So paths and bmp retrieval will improve but for testing just now best copy the bmp to the ffu folder like tick and cross bmps
If you look under [tool] case 6 you will see it gets the width and height as soon as it loads the bmp
|
|
|
Post by Rod on May 8, 2023 15:55:03 GMT -5
The issue with the window size is two fold, parsing should not return 0. But sizing the window is trying to accommodate the frame and scroll bar size changes depending on window type. I have not got that right just yet. Remember the form is presented as the client area excluding frame and scroll bar and titlebar height. So those are added on Write. But I need to deduct them on import, not coded yet.
|
|
|
Post by tsh73 on May 8, 2023 16:04:44 GMT -5
Then importing stuff, you should clear some variables If WindowWidth is here is supposed to set w$ But if not? I get the word "END" And h$ left unset by (again missing) WindowHeight, and happened to retain form height value from last time.
|
|
|
Post by tsh73 on May 8, 2023 16:06:02 GMT -5
Yes but on import it does not load - so it does not know size - so you cannot select and move/resize because it thinks size is 0 (so you cannot get "inside" with a mouse)
|
|
|
Post by tsh73 on May 8, 2023 16:30:19 GMT -5
Part for loading buttons without size given and with different corners (draws then approximately right but converts to default UL) so BUTTONS1.bas CALC2.bas could be imported
if w=5 and i=3 then 'no w,h given obj(obj,1)=val(word$(ll$,i+2,","))'x obj(obj,2)=val(word$(ll$,i+3,","))'y obj(obj,3)=max(len(obj$(obj,2)),3)*10'w obj(obj,4)=obj(obj,6) 'h end if if w=5 and upper$(word$(ll$,4,","))="LR" then obj(obj,1)=projectw-obj(obj,1)-obj(obj,3)'x obj(obj,2)=projecth-obj(obj,2)-obj(obj,4)'y end if if w=5 and upper$(word$(ll$,4,","))="LL" then 'obj(obj,1)=projectw-obj(obj,1)-obj(obj,3)'x obj(obj,2)=projecth-obj(obj,2)-obj(obj,4)'y end if if w=5 and upper$(word$(ll$,4,","))="UR" then obj(obj,1)=projectw-obj(obj,1)-obj(obj,3)'x 'obj(obj,2)=projecth-obj(obj,2)-obj(obj,4)'y end if
(but controls in these programs are unnamed so preview balks at extra (.) without name
button #calc.,"0",[click], UL, 5,267,30,25 and since where is no name, all handler labels come out the same
[click] [click] instead of
[bt1click] [bt2click] , leading to "Duplicate labels" error )
|
|
|
Post by Walt Decker on May 8, 2023 17:13:56 GMT -5
Hint: Get the values from User32.DLL function GetSystemMetrics() and hard code those values. Don't forget the menu bar. That takes up part of the client area.
|
|