|
Post by tsh73 on Aug 18, 2023 17:13:32 GMT -5
Trying to run function: dies in [runKey], "Invalid file handle" problem is
#CodeTank.value "!contents? code$" should be from lower "c"
#codeTank.value
actually search found 8 more "CodeTank" Probably they all should be converted to "codeTank"
actually not 8 but 4, other 4 are commented out
|
|
|
Post by xxgeek on Aug 18, 2023 17:31:52 GMT -5
That display works here too Anatoly, added to new version.
Edit Oh boy. On it Edit Fixed
New version 1.3.1
|
|
|
Post by Walt Decker on Aug 18, 2023 17:51:47 GMT -5
That is correct. Consider the possibility of a user copying the code to a different drive/directory. Now you have files and directories in two, perhaps more, different places none are the same because of different actions. Perhaps the better solution is to place the cfg/ini file in a directory in the c:\user path and all of the other directories/files under that directory.
I finally jiggered the original code to partially begin to work on my system. File explorer does not show a liberty basic path in c:\program files so I used FN_Dir.dll to check the path AND existance of lbpro.exe. The path is there but the exe is not.
Also at the top I checked for the ini file.
I played with the FUNCTIONS radio button and had to make some changes for it to work somewhat. However, when using the run button, the LB IDE came up with the codebank code instead of a separate window with the function in it.
When closing I received an error message declaring that temp.txt was not found. Had to use file manager to exit the IDE.
I will play with your new code perhaps this evening and see what happens.
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Aug 19, 2023 3:08:18 GMT -5
Hello. I don't have liberty pro on my computer. So I ran the pro version and it didn't ask me where the Liberty pro (LBpro.exe) version was. However, it ran normally from the free version (Lyberty.exe).
Gaslouk.
|
|
|
Post by xxgeek on Aug 19, 2023 9:51:39 GMT -5
Hello. I don't have liberty pro on my computer. So I ran the pro version and it didn't ask me where the Liberty pro (LBpro.exe) version was. However, it ran normally from the free version (Lyberty.exe). Gaslouk. Thanks again gaslouk, I doubt I would have noticed this issue since it doesn't affect my setup. I'll be re-working the code today to fix this and some of Walts reported issues. I will also be changing the code so that MyProjects, and MyPrograms will autosave like the rest of the radiobuttons, and the [update TKN] button will take the code from the editor to re-create the .bas/tkn in the Project's dir. Instead of reading the .bas in the Project's dir initially, and loading the texteditor with the code, I will have it read the 'dictionary' file, and load the texteditor with that code. That should work better than the present arrangement. gaslouk, the free version will eventually have problems with this app, and others. I would recommend purchasing the Pro version with the extra features if/when you decide to buy Liberty. If you notice anything else don't hesitate to let me know. It may be a day or so for the next version.
|
|
|
Post by Walt Decker on Aug 19, 2023 13:52:49 GMT -5
There are two ways to ensure that forms will fit the user monitor. 1) Change the user monitor resolution to match your development monitor and when the app closes change back to the user setting; 2) resize the form(s) and all controls to fit. Changing the user resolution is the easier way, however, it has problems because any other apps the user has running and all icons on the desktop change size. Resizing the app, in Liberty Basic, requires more code than in other languages because LB does not supply enough information. The method below changes the size of the form size and 2 controls that no longer fit the new size. Note that this DOES NOT consider monitor points per inch(PPI) changes made by the user. In LB that takes a bunch more code since themes can not be used. However, at least in LB 4x/Pro, the app can be made PPI aware. I forget the API call, but Mr. Parker posted it on the forum about 5 months ago. ' RetVal = FN.CreateBankWindow() wait
FUNCTION FN.CreateBankWindow()
DevMonx = 1024 '<--- development moitor resolution DevMony = 760 Devmonszx = DevMonx * DevMony
UsrMonx = 0 '<--- user monitor resolution UsrMony = 0 UsrMonszx = 0
WinWide = 1000 WinHigh = 600
EdtUx = 410 '<--- location and size of text editor EdtUy = 25 Edtszx = 575 Edtszy = 475
TxbUx = 190 '<--- location and size of text box TxbUy = 2 Txbsx = 785 Txbsy = 22
Aspect = 0.0 '<--- ratio between development monitor and user monitor RetVal = 0 SzxFlg = 0 SzyFlg = 0
RetVal = FN.Screen(UsrMonx, UsrMony) '<--- get user monitor resolution UsrMonszx = UsrMonx * UsrMony 'and calculate aspect ratio Aspect = UsrMonszx / Devmonszx
IF WinWide > UsrMonx THEN '<--- check user resolution for fit WinWide = INT(WinWide * Aspect) SzxFlg = 1 print WinWide END IF
IF WinHigh > UsrMony THEN '<--- check user resolution for fit WinHigh = INT(WinHigh * Aspect) SzyFlg = 1 END IF
Cx = 0 '<--- monitor center Cy = 0
savedProjects$ = "savedProjects" MyProjects$ = "MyProjects" MyBackups$ = "MyBackups" programs$ = "Programs" vbs$ = "VBS-Scripts" cmd$ = "CMD-Scripts" examples$ = "Examples" snippets$ = "Snippets" lbExamples$ = "LB-Examples" lbBakFiles$ = "LB-BAK-Files" subroutines$ = "Subroutines" functions$ = "Functions" mainFontsize = 10
menu #CodeTank, "File" , "Open Liberty Basic", [openlb], "Open a File in Liberty Basic", [openlbFile], "Exit", [quit.codebank] menu #CodeTank, "Edit" menu #CodeTank, "Browse" , "My Projects", [projectsDir], ".TKN Files", [tknDir], ".BAS Files", [basFiles],"DefaultDir$", [defaultDir],"LB Code Examples", [lbexamplesDir] menu #CodeTank, "Help" , "Liberty Basic Forums", [forumlink], "Help", [codebankHelp], "About", [about]
texteditor #CodeTank.value, 410, 25, 575, 475
listbox #CodeTank.keys, keys$(), [keySelected], 105, 25, 300, 370
'category radio buttons radiobutton #CodeTank.savedprojects, MyProjects$, [projs], resetHandler, 5, 75, 95, 20 radiobutton #CodeTank.programs, "My";programs$, [progs], resetHandler, 5, 95, 95, 20 radiobutton #CodeTank.backups, MyBackups$, [mybackups], resetHandler, 5, 115, 95, 20 radiobutton #CodeTank.examples, examples$, [exams], resetHandler, 5, 165, 80, 95 radiobutton #CodeTank.snippets, snippets$, [snipps], resetHandler, 5, 185, 95, 20 radiobutton #CodeTank.subroutines, subroutines$, [subroutines], resetHandler, 5, 205, 95, 20 radiobutton #CodeTank.functions, functions$, [functions], resetHandler, 5, 225, 95, 20 radiobutton #CodeTank.VBS, vbs$, [vbs], resetHandler, 5, 245, 95, 20 radiobutton #CodeTank.CMD, cmd$, [cmd], resetHandler, 5, 265, 95, 20 radiobutton #CodeTank.lbexamples, lbExamples$, [lbCodeExamples], resetHandler, 5, 315, 95, 20 radiobutton #CodeTank.lbbakfiles, lbBakFiles$, [lbbakfiles], resetHandler, 5, 335, 95, 20 radiobutton #CodeTank.folderChoice, "Any Folder", [folderChoice], resetHandler, 5, 375, 95, 20 'buttons bottom left , top, and middle button #CodeTank.addListing, "New ";left$(categorie$, (len(categorie$) - 1)), [newKey], ul, 245, 405, 140, 20 button #CodeTank.fromFile, "&New from &File", [makeproject], ul, 95, 405, 140, 20 button #CodeTank.remakeproject, "&Update TKN File", [remakeproject], ul, 95, 455, 140, 20 button #CodeTank.runlb, "&Edit in Liberty Basic", [edit_In_LB_IDE], ul, 95, 430, 140, 20 button #CodeTank.merge, "&Merge Shared File ";categorie$, [mergeFile], ul, 245, 455, 140, 20 button #CodeTank.runListing, "&Run", [runKey], ul, 245, 430, 140, 20 button #CodeTank.revert, "Re&vert to Backup", [revert], ul, 95, 480, 140, 20 button #CodeTank.deleteListing, " &Delete ", [deleteKey], ul, 245, 480, 140, 20 textbox #CodeTank.filePath, 190, 2, 785, 22 statictext #CodeTank.categories, "Categories", 10, 40, 80, 15 statictext #CodeTank.pathText, "Currently Viewing", 100, 8, 80, 15 button #CodeTank.incFont, "&+", [incFont], UL, 25, 470, 20, 23 button #CodeTank.decFont, "&-", [decFont], UL, 50, 470, 20, 23
'################################################################ ' If you want to make the form fit the user screen add the following: ' ' RetVal = FN.Screen(WinWide, WinHigh) '<--- disregard the previous size 'and aspect ration '################################################################
RetVal = FN.ScreenCenter(Cx, Cy) '<--- get screen center RetVal = FN.SetWinPos(Cx - INT(WinWide / 2), Cy - INT(WinHigh / 2)) '<--- set window pos RetVal = FN.SetWinSize(WinWide, WinHigh) '<--- set window size
open " CodeTank Plus v1.3 " for window as #CodeTank ' #CodeTank "trapclose [quit.CodeTank]" #CodeTank "font arial ";mainFontsize #CodeTank.addListing "!disable" #CodeTank.deleteListing "!disable" #CodeTank.remakeproject "!disable" #CodeTank.runListing "!disable" #CodeTank.runlb "!disable" #CodeTank.fromFile "!disable" #CodeTank.merge "!disable" #CodeTank.revert "!disable" #CodeTank.keys "singleclickselect" #CodeTank.value "!autoresize" CodeTankOpen = 1
'################################################################ ' NOTE: The window size is 16 units larger than the window client ' area. To set the new size of the controls they must be decreased ' by the taking the upper left corner from the client area minus the ' border. The "-20" comes from the sizing border plus 4 units for ' the border of the text box and text editor. '################################################################
IF SzxFlg THEN '<--- check size flag Txbsx = WinWide - TxbUx - 20 '<--- resize text box Edtszx = WinWide - EdtUx - 20 '<--- resize text editor #CodeTank.filePath, "!LOCATE ";TxbUx;" ";TxbUy;" ";Txbsx;" ";Txbsy #CodeTank.value, "!LOCATE ";EdtUx;" ";EdtUy;" ";Edtszx;" ";Edtszy END IF
#CodeTank, "REFRESH" END FUNCTION
'----------------------------------------------------------- '-----------------------------------------------------------
FUNCTION FN.Screen(BYREF Szx, BYREF Szy)
Szx = DisplayWidth Szy = DisplayHeight
FN.Display = Szx * Szy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.PercentScreen(PercentX, PercentY, BYREF Szx, BYREF Szy)
Szx = INT(DisplayWidth * PercentX) Szy = INT(DisplayHeight * PercentY)
FN.PercentScreen = Szx * Szy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.ScreenCenter(BYREF Cx, BYREF Cy)
Cx = INT(DisplayWidth * 0.5) Cy = INT(DisplayHeight * 0.5)
FN.ScreenCenter = Cx * Cy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.SetWinPos(PosX, PosY)
UpperLeftX = PosX UpperLeftY = PosY
FN.SetWinPos = PosX * PosY END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.SetWinSize(Szx, Szy)
WindowWidth = Szx WindowHeight = Szy
FN.SetWinSize = Szx * Szy END FUNCTION
'-------------------------- '-------------------------- '
|
|
|
Post by Rod on Aug 19, 2023 14:32:49 GMT -5
Not in favour of messing with the users screen screen resolution. Potential for much angst and frustration.
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Aug 20, 2023 0:29:00 GMT -5
There are two ways to ensure that forms will fit the user monitor. 1) Change the user monitor resolution to match your development monitor and when the app closes change back to the user setting; 2) resize the form(s) and all controls to fit. Changing the user resolution is the easier way, however, it has problems because any other apps the user has running and all icons on the desktop change size. Resizing the app, in Liberty Basic, requires more code than in other languages because LB does not supply enough information. The method below changes the size of the form size and 2 controls that no longer fit the new size. Note that this DOES NOT consider monitor points per inch(PPI) changes made by the user. In LB that takes a bunch more code since themes can not be used. However, at least in LB 4x/Pro, the app can be made PPI aware. I forget the API call, but Mr. Parker posted it on the forum about 5 months ago. ' RetVal = FN.CreateBankWindow() wait
FUNCTION FN.CreateBankWindow()
DevMonx = 1024 '<--- development moitor resolution DevMony = 760 Devmonszx = DevMonx * DevMony
UsrMonx = 0 '<--- user monitor resolution UsrMony = 0 UsrMonszx = 0
WinWide = 1000 WinHigh = 600
EdtUx = 410 '<--- location and size of text editor EdtUy = 25 Edtszx = 575 Edtszy = 475
TxbUx = 190 '<--- location and size of text box TxbUy = 2 Txbsx = 785 Txbsy = 22
Aspect = 0.0 '<--- ratio between development monitor and user monitor RetVal = 0 SzxFlg = 0 SzyFlg = 0
RetVal = FN.Screen(UsrMonx, UsrMony) '<--- get user monitor resolution UsrMonszx = UsrMonx * UsrMony 'and calculate aspect ratio Aspect = UsrMonszx / Devmonszx
IF WinWide > UsrMonx THEN '<--- check user resolution for fit WinWide = INT(WinWide * Aspect) SzxFlg = 1 print WinWide END IF
IF WinHigh > UsrMony THEN '<--- check user resolution for fit WinHigh = INT(WinHigh * Aspect) SzyFlg = 1 END IF
Cx = 0 '<--- monitor center Cy = 0
savedProjects$ = "savedProjects" MyProjects$ = "MyProjects" MyBackups$ = "MyBackups" programs$ = "Programs" vbs$ = "VBS-Scripts" cmd$ = "CMD-Scripts" examples$ = "Examples" snippets$ = "Snippets" lbExamples$ = "LB-Examples" lbBakFiles$ = "LB-BAK-Files" subroutines$ = "Subroutines" functions$ = "Functions" mainFontsize = 10
menu #CodeTank, "File" , "Open Liberty Basic", [openlb], "Open a File in Liberty Basic", [openlbFile], "Exit", [quit.codebank] menu #CodeTank, "Edit" menu #CodeTank, "Browse" , "My Projects", [projectsDir], ".TKN Files", [tknDir], ".BAS Files", [basFiles],"DefaultDir$", [defaultDir],"LB Code Examples", [lbexamplesDir] menu #CodeTank, "Help" , "Liberty Basic Forums", [forumlink], "Help", [codebankHelp], "About", [about]
texteditor #CodeTank.value, 410, 25, 575, 475
listbox #CodeTank.keys, keys$(), [keySelected], 105, 25, 300, 370
'category radio buttons radiobutton #CodeTank.savedprojects, MyProjects$, [projs], resetHandler, 5, 75, 95, 20 radiobutton #CodeTank.programs, "My";programs$, [progs], resetHandler, 5, 95, 95, 20 radiobutton #CodeTank.backups, MyBackups$, [mybackups], resetHandler, 5, 115, 95, 20 radiobutton #CodeTank.examples, examples$, [exams], resetHandler, 5, 165, 80, 95 radiobutton #CodeTank.snippets, snippets$, [snipps], resetHandler, 5, 185, 95, 20 radiobutton #CodeTank.subroutines, subroutines$, [subroutines], resetHandler, 5, 205, 95, 20 radiobutton #CodeTank.functions, functions$, [functions], resetHandler, 5, 225, 95, 20 radiobutton #CodeTank.VBS, vbs$, [vbs], resetHandler, 5, 245, 95, 20 radiobutton #CodeTank.CMD, cmd$, [cmd], resetHandler, 5, 265, 95, 20 radiobutton #CodeTank.lbexamples, lbExamples$, [lbCodeExamples], resetHandler, 5, 315, 95, 20 radiobutton #CodeTank.lbbakfiles, lbBakFiles$, [lbbakfiles], resetHandler, 5, 335, 95, 20 radiobutton #CodeTank.folderChoice, "Any Folder", [folderChoice], resetHandler, 5, 375, 95, 20 'buttons bottom left , top, and middle button #CodeTank.addListing, "New ";left$(categorie$, (len(categorie$) - 1)), [newKey], ul, 245, 405, 140, 20 button #CodeTank.fromFile, "&New from &File", [makeproject], ul, 95, 405, 140, 20 button #CodeTank.remakeproject, "&Update TKN File", [remakeproject], ul, 95, 455, 140, 20 button #CodeTank.runlb, "&Edit in Liberty Basic", [edit_In_LB_IDE], ul, 95, 430, 140, 20 button #CodeTank.merge, "&Merge Shared File ";categorie$, [mergeFile], ul, 245, 455, 140, 20 button #CodeTank.runListing, "&Run", [runKey], ul, 245, 430, 140, 20 button #CodeTank.revert, "Re&vert to Backup", [revert], ul, 95, 480, 140, 20 button #CodeTank.deleteListing, " &Delete ", [deleteKey], ul, 245, 480, 140, 20 textbox #CodeTank.filePath, 190, 2, 785, 22 statictext #CodeTank.categories, "Categories", 10, 40, 80, 15 statictext #CodeTank.pathText, "Currently Viewing", 100, 8, 80, 15 button #CodeTank.incFont, "&+", [incFont], UL, 25, 470, 20, 23 button #CodeTank.decFont, "&-", [decFont], UL, 50, 470, 20, 23
'################################################################ ' If you want to make the form fit the user screen add the following: ' ' RetVal = FN.Screen(WinWide, WinHigh) '<--- disregard the previous size 'and aspect ration '################################################################
RetVal = FN.ScreenCenter(Cx, Cy) '<--- get screen center RetVal = FN.SetWinPos(Cx - INT(WinWide / 2), Cy - INT(WinHigh / 2)) '<--- set window pos RetVal = FN.SetWinSize(WinWide, WinHigh) '<--- set window size
open " CodeTank Plus v1.3 " for window as #CodeTank ' #CodeTank "trapclose [quit.CodeTank]" #CodeTank "font arial ";mainFontsize #CodeTank.addListing "!disable" #CodeTank.deleteListing "!disable" #CodeTank.remakeproject "!disable" #CodeTank.runListing "!disable" #CodeTank.runlb "!disable" #CodeTank.fromFile "!disable" #CodeTank.merge "!disable" #CodeTank.revert "!disable" #CodeTank.keys "singleclickselect" #CodeTank.value "!autoresize" CodeTankOpen = 1
'################################################################ ' NOTE: The window size is 16 units larger than the window client ' area. To set the new size of the controls they must be decreased ' by the taking the upper left corner from the client area minus the ' border. The "-20" comes from the sizing border plus 4 units for ' the border of the text box and text editor. '################################################################
IF SzxFlg THEN '<--- check size flag Txbsx = WinWide - TxbUx - 20 '<--- resize text box Edtszx = WinWide - EdtUx - 20 '<--- resize text editor #CodeTank.filePath, "!LOCATE ";TxbUx;" ";TxbUy;" ";Txbsx;" ";Txbsy #CodeTank.value, "!LOCATE ";EdtUx;" ";EdtUy;" ";Edtszx;" ";Edtszy END IF
#CodeTank, "REFRESH" END FUNCTION
'----------------------------------------------------------- '-----------------------------------------------------------
FUNCTION FN.Screen(BYREF Szx, BYREF Szy)
Szx = DisplayWidth Szy = DisplayHeight
FN.Display = Szx * Szy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.PercentScreen(PercentX, PercentY, BYREF Szx, BYREF Szy)
Szx = INT(DisplayWidth * PercentX) Szy = INT(DisplayHeight * PercentY)
FN.PercentScreen = Szx * Szy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.ScreenCenter(BYREF Cx, BYREF Cy)
Cx = INT(DisplayWidth * 0.5) Cy = INT(DisplayHeight * 0.5)
FN.ScreenCenter = Cx * Cy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.SetWinPos(PosX, PosY)
UpperLeftX = PosX UpperLeftY = PosY
FN.SetWinPos = PosX * PosY END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.SetWinSize(Szx, Szy)
WindowWidth = Szx WindowHeight = Szy
FN.SetWinSize = Szx * Szy END FUNCTION
'-------------------------- '-------------------------- '
Hi, there is a fault in your code.
radiobutton #CodeTank.examples, examples$, [exams], resetHandler, 5, 165, 80, 95
must be
radiobutton #CodeTank.examples, examples$, [exams], resetHandler, 5, 165, 80, 20
and the "#CodeTank" must be "#codeTank" Thanks
Gaslouk
|
|
|
Post by Walt Decker on Aug 20, 2023 8:59:50 GMT -5
No. All the controls are "CodeTank.something" and the window is "CodeTank". That is to distinguish it from the "real" source code.
|
|
|
Post by xxgeek on Aug 20, 2023 11:54:57 GMT -5
Good day everyone. gaslouk, the CodeTank/codeTank thing is an easy fix for me, and so is the 95 edit to 20. I saw that soon as I ran it, thanks though. It's always good to have more eyes on the code. Your input is appreciated my friend. walt, that was a bit of a learning curve, but I think I got it right. It would be nice to have you check it though. I don't really like adding code I don't understand well, but in some cases it is the best option, and I being new to LB need to learn a lot more. Thanks for the amount of effort you put in to help out. Ok, off to edit the non Pro version.... I just updated the Pro version to v1.3.4 with the code Walt posted, and a few other edits. You can now edit the code in the text editor for MyPrograms, an MyProjects, and it will be saved the same way the other categories save, to the appropriate dictionary 'categorie$' That change means the actual MyProject.bas, or MyProgram .bas file DOES NOT get updated (unless, and until the [Update TKN] button is pressed. If there is an original saved file (.bas) it will get updated with the TKN. But if the MyProject or MyProgram was created manually via (copy/paste), or the user deletes the folder or file, the user will be notified, and given instructions on how to proceed. I limited the display to max 800x600 for the visually impaired. It appears ok here, and I'll maximize the window manually when needed. Let me know Walt. It has been running like a swiss watch for me, let me know how it works for you, please. Errors CAN happen. The main problem, or reason, is the LB commandline for opening/running .bas files. It opens the IDE and attempts to compile. If the compiler has no issues, we're golden, else the IDE hangs open, and the automation stops dead and causes errors, but not in CodeTank, the error is with the selected .bas file trying to RUN. So make sure you run ONLY known good files to avoid this issue. Thing is, I have allowed for more 'categories' to Open/Edit/Run .bas files from a few different folders, and CANNOT determine if any of those files WILL be an issue until they are RUN. If it DOES happen, just close the offending IDE window, and all should be ok. I'll get to work on the non Pro version now. Shouldn't take too long to change a few paths, and remove a few "Pro" texts.
|
|
|
Post by xxgeek on Aug 20, 2023 13:56:18 GMT -5
Updated non Pro version to v1.3.4 Delayed, sorry about that.
|
|
|
Post by tsh73 on Aug 20, 2023 13:58:25 GMT -5
Re: pro version/non-pro version I have saved v.1 and it seems that the only meaningful difference (skipping tank/bank) between pro version/non-pro version were * LBpath$ * LBexe$ * LBruntime$ Am I missing something? Does it still the case? Does it worth to keep separate versions? Just check if LB Pro is installed - if so, set variables to pro Else set variables to ordinary LB (else ask for path, as now)
It might save you some time (and copy/paste errors).
*trying to run 1.3.4* Errors like this one: check one name but opens another one
if fileExists(DefaultDir$, "codetankPro.ini") then open "codetank.ini" for input as #1 line input #1, LBpath$ : close #1 LBpath$ = trim$(LBpath$) goto [start] end if
|
|
|
Post by tsh73 on Aug 20, 2023 14:20:50 GMT -5
1.3.4: It happens then INI file exist, program jumps to [start] without setting LBexe$ It gives errors (file not fond) trying to open stuff in LB ("Edit in Liberty Basic" button)
|
|
|
Post by xxgeek on Aug 20, 2023 15:28:25 GMT -5
1.3.4: It happens then INI file exist, program jumps to [start] without setting LBexe$ It gives errors (file not fond) trying to open stuff in LB ("Edit in Liberty Basic" button) You may need to delete the old ini. Check, it may be empty. Pro version was using codetank.ini, and codetankPro.ini Non Pro version was using codetankPro.ini, and codetank.ini Messed up some other stuff too, fixed now. Same ver # Thanks Anatoly. I hope that's all there is. I see the scroll bar needs work again, but that's easy enough. Is the display ok with you, and Walt now? Users can always resize once opened. I don't mind. Don't need the larger size much anyway.
|
|
|
Post by tsh73 on Aug 20, 2023 15:46:33 GMT -5
As of now, it is off (editor too big, textbox is too long)
I just finished playing with Walt resizer code set one variable to 1 so it scaled down to 800 initially added some stuff from a help file Now it starts 800x600, texteditor and texbox above scaled to window size, resizing moves buttons (they now not UpperLeft but LowerLeft-bound) changes texteditor (autoresize) and listbox and texbox (with LOCATE).
Have a look.
RetVal = FN.CreateBankWindow() wait
FUNCTION FN.CreateBankWindow()
DevMonx = 1024 '<--- development moitor resolution DevMony = 760 Devmonszx = DevMonx * DevMony
UsrMonx = 0 '<--- user monitor resolution UsrMony = 0 UsrMonszx = 0
WinWide = 1000 WinWide = 800 '200 less WinHigh = 600
EdtUx = 410 '<--- location and size of text editor EdtUy = 25 Edtszx = 575 Edtszy = 475
TxbUx = 190 '<--- location and size of text box TxbUy = 2 Txbsx = 785 Txbsy = 22
Aspect = 0.0 '<--- ratio between development monitor and user monitor RetVal = 0 SzxFlg = 0 SzyFlg = 0
RetVal = FN.Screen(UsrMonx, UsrMony) '<--- get user monitor resolution UsrMonszx = UsrMonx * UsrMony 'and calculate aspect ratio Aspect = UsrMonszx / Devmonszx
IF WinWide > UsrMonx THEN '<--- check user resolution for fit WinWide = INT(WinWide * Aspect) SzxFlg = 1 print WinWide END IF
IF WinHigh > UsrMony THEN '<--- check user resolution for fit WinHigh = INT(WinHigh * Aspect) SzyFlg = 1 END IF
Cx = 0 '<--- monitor center Cy = 0
savedProjects$ = "savedProjects" MyProjects$ = "MyProjects" MyBackups$ = "MyBackups" programs$ = "Programs" vbs$ = "VBS-Scripts" cmd$ = "CMD-Scripts" examples$ = "Examples" snippets$ = "Snippets" lbExamples$ = "LB-Examples" lbBakFiles$ = "LB-BAK-Files" subroutines$ = "Subroutines" functions$ = "Functions" mainFontsize = 10
menu #CodeTank, "File" , "Open Liberty Basic", [openlb], "Open a File in Liberty Basic", [openlbFile], "Exit", [quit.codebank] menu #CodeTank, "Edit" menu #CodeTank, "Browse" , "My Projects", [projectsDir], ".TKN Files", [tknDir], ".BAS Files", [basFiles],"DefaultDir$", [defaultDir],"LB Code Examples", [lbexamplesDir] menu #CodeTank, "Help" , "Liberty Basic Forums", [forumlink], "Help", [codebankHelp], "About", [about]
texteditor #CodeTank.value, 410, 25, 575, 475
listbox #CodeTank.keys, keys$(), [keySelected], 105, 25, 300, 370
'category radio buttons radiobutton #CodeTank.savedprojects, MyProjects$, [projs], resetHandler, 5, 75, 95, 20 radiobutton #CodeTank.programs, "My";programs$, [progs], resetHandler, 5, 95, 95, 20 radiobutton #CodeTank.backups, MyBackups$, [mybackups], resetHandler, 5, 115, 95, 20 radiobutton #CodeTank.examples, examples$, [exams], resetHandler, 5, 165, 80, 95 radiobutton #CodeTank.snippets, snippets$, [snipps], resetHandler, 5, 185, 95, 20 radiobutton #CodeTank.subroutines, subroutines$, [subroutines], resetHandler, 5, 205, 95, 20 radiobutton #CodeTank.functions, functions$, [functions], resetHandler, 5, 225, 95, 20 radiobutton #CodeTank.VBS, vbs$, [vbs], resetHandler, 5, 245, 95, 20 radiobutton #CodeTank.CMD, cmd$, [cmd], resetHandler, 5, 265, 95, 20 radiobutton #CodeTank.lbexamples, lbExamples$, [lbCodeExamples], resetHandler, 5, 315, 95, 20 radiobutton #CodeTank.lbbakfiles, lbBakFiles$, [lbbakfiles], resetHandler, 5, 335, 95, 20 radiobutton #CodeTank.folderChoice, "Any Folder", [folderChoice], resetHandler, 5, 375, 95, 20 'buttons bottom left , top, and middle ' button #CodeTank.addListing, "New ";left$(categorie$, (len(categorie$) - 1)), [newKey], ul, 245, 405, 140, 20 ' button #CodeTank.fromFile, "&New from &File", [makeproject], ul, 95, 405, 140, 20 ' button #CodeTank.remakeproject, "&Update TKN File", [remakeproject], ul, 95, 455, 140, 20 ' button #CodeTank.runlb, "&Edit in Liberty Basic", [edit_In_LB_IDE], ul, 95, 430, 140, 20 ' button #CodeTank.merge, "&Merge Shared File ";categorie$, [mergeFile], ul, 245, 455, 140, 20 ' button #CodeTank.runListing, "&Run", [runKey], ul, 245, 430, 140, 20 ' button #CodeTank.revert, "Re&vert to Backup", [revert], ul, 95, 480, 140, 20 ' button #CodeTank.deleteListing, " &Delete ", [deleteKey], ul, 245, 480, 140, 20 textbox #CodeTank.filePath, 190, 2, 785, 22 statictext #CodeTank.categories, "Categories", 10, 40, 80, 15 statictext #CodeTank.pathText, "Currently Viewing", 100, 8, 80, 15 ' button #CodeTank.incFont, "&+", [incFont], UL, 25, 470, 20, 23 ' button #CodeTank.decFont, "&-", [decFont], UL, 50, 470, 20, 23
wh=WinHigh-100 button #CodeTank.addListing, "New ";left$(categorie$, (len(categorie$) - 1)), [newKey], LL, 245, wh-405, 140, 20 button #CodeTank.fromFile, "&New from &File", [makeproject], LL, 95, wh-405, 140, 20 button #CodeTank.remakeproject, "&Update TKN File", [remakeproject], LL, 95, wh-455, 140, 20 button #CodeTank.runlb, "&Edit in Liberty Basic", [edit_In_LB_IDE], LL, 95, wh-430, 140, 20 button #CodeTank.merge, "&Merge Shared File ";categorie$, [mergeFile], LL, 245, wh-455, 140, 20 button #CodeTank.runListing, "&Run", [runKey], LL, 245, wh-430, 140, 20 button #CodeTank.revert, "Re&vert to Backup", [revert], LL, 95, wh-480, 140, 20 button #CodeTank.deleteListing, " &Delete ", [deleteKey], LL, 245, wh-480, 140, 20 button #CodeTank.incFont, "&+", [incFont], LL, 25, wh-470, 20, 23 button #CodeTank.decFont, "&-", [decFont], LL, 50, wh-470, 20, 23
'################################################################ ' If you want to make the form fit the user screen add the following: ' ' RetVal = FN.Screen(WinWide, WinHigh) '<--- disregard the previous size 'and aspect ration '################################################################
RetVal = FN.ScreenCenter(Cx, Cy) '<--- get screen center RetVal = FN.SetWinPos(Cx - INT(WinWide / 2), Cy - INT(WinHigh / 2)) '<--- set window pos RetVal = FN.SetWinSize(WinWide, WinHigh) '<--- set window size
open " CodeTank Plus v1.3 " for window as #CodeTank ' #CodeTank "trapclose [quit.CodeTank]" #CodeTank "font arial ";mainFontsize #CodeTank.addListing "!disable" #CodeTank.deleteListing "!disable" #CodeTank.remakeproject "!disable" #CodeTank.runListing "!disable" #CodeTank.runlb "!disable" #CodeTank.fromFile "!disable" #CodeTank.merge "!disable" #CodeTank.revert "!disable" #CodeTank.keys "singleclickselect" #CodeTank.value "!autoresize" 'add this line and resized sub to resize texteditor and listbox #CodeTank "resizehandler resized" CodeTankOpen = 1
'################################################################ ' NOTE: The window size is 16 units larger than the window client ' area. To set the new size of the controls they must be decreased ' by the taking the upper left corner from the client area minus the ' border. The "-20" comes from the sizing border plus 4 units for ' the border of the text box and text editor. '################################################################
'to scale it down to 800x600 you need to set that to 1 SzxFlg = 1
IF SzxFlg THEN '<--- check size flag Txbsx = WinWide - TxbUx - 20 '<--- resize text box Edtszx = WinWide - EdtUx - 20 '<--- resize text editor #CodeTank.filePath, "!LOCATE ";TxbUx;" ";TxbUy;" ";Txbsx;" ";Txbsy #CodeTank.value, "!LOCATE ";EdtUx;" ";EdtUy;" ";Edtszx;" ";Edtszy #CodeTank.value "!autoresize" 'this will autoresize from new value END IF
#CodeTank, "REFRESH" END FUNCTION
'----------------------------------------------------------- '-----------------------------------------------------------
FUNCTION FN.Screen(BYREF Szx, BYREF Szy)
Szx = DisplayWidth Szy = DisplayHeight
FN.Display = Szx * Szy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.PercentScreen(PercentX, PercentY, BYREF Szx, BYREF Szy)
Szx = INT(DisplayWidth * PercentX) Szy = INT(DisplayHeight * PercentY)
FN.PercentScreen = Szx * Szy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.ScreenCenter(BYREF Cx, BYREF Cy)
Cx = INT(DisplayWidth * 0.5) Cy = INT(DisplayHeight * 0.5)
FN.ScreenCenter = Cx * Cy END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.SetWinPos(PosX, PosY)
UpperLeftX = PosX UpperLeftY = PosY
FN.SetWinPos = PosX * PosY END FUNCTION
'-------------------------- '--------------------------
FUNCTION FN.SetWinSize(Szx, Szy)
WindowWidth = Szx WindowHeight = Szy
FN.SetWinSize = Szx * Szy END FUNCTION
'-------------------------- '-------------------------- ' sub resized handle$ 'print handle$, WindowWidth, WindowHeight TxbUx = 190 '<--- location and size of text box TxbUy = 2 Txbsx = 785 Txbsy = 22 Txbsx = WindowWidth - TxbUx - 20 '<--- resize text box #CodeTank.filePath, "!LOCATE ";TxbUx;" ";TxbUy;" ";Txbsx;" ";Txbsy #CodeTank.keys, "LOCATE ";105;" ";25;" ";300;" ";WindowHeight-600+60+370 #CodeTank, "REFRESH" end sub
|
|