Welcome Guest. Please Login or Register. Apr 1st, 2018, 03:48am
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. We apologize Conforums does not have any export functions to migrate data. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
Re: Variables in MAINWIN statement
« Reply #1 on: Aug 9th, 2017, 7:36pm »
Richard
MAINWIN is not an executable statement but a tokeniser directive. During the creation of a token file the basic is scanned for MAINWIN statements and the the values for rows and columns are stored in the token file. If variables are used then values of zero are used. Zero values give a maximised window. If more than one MAINWIN statement exists in a basic file then the last one is used.
MAINWIN is not an executable statement but a tokeniser directive.
How very strange; is that formally documented anywhere? I can't see anything in the main LB Help file that even hints at it: MAINWIN is described just like any other statement (unlike NOMAINWIN which is listed as a 'directive').
Needless to say in LBB it works 'sensibly': you can specify the dimensions with variables and you change the size of the mainwin whenever you wish as the program runs. I suppose I should add this to the list of enhancements.
Even when you think you can't be surprised by LB 4 any more, something else pops out of the woodwork!
Re: Variables in MAINWIN statement
« Reply #3 on: Aug 9th, 2017, 8:41pm »
Richard
The only hint that MAINWIN is a directive is in the help -
"This statement is usually placed at the beginning of the program code."
In LB the size of the main window is fixed when the program is tokenised. The advantage of LBB is that the size can be dynamically changed during execution.
"This statement is usually placed at the beginning of the program code."
Well, to me that hints at the opposite! If it makes no difference where the MAINWIN statement goes, why recommend that it goes at the beginning? In the case of LBB, however, it does matter that it goes near the beginning, to ensure the wanted size is established as quickly as possible.
Hence the documentation would lead me to expect the LBB behaviour, and in well over five years I've never had any reason to doubt it. Only in experimenting with MAINWIN in a console program did I notice anything unexpected.