LB Booster
« Variables in MAINWIN statement »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:29am



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!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Variables in MAINWIN statement  (Read 206 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Variables in MAINWIN statement
« Thread started on: Aug 9th, 2017, 4:50pm »

I've been looking into the possibility of supporting the MAINWIN statement in LBB console programs (to set the window size), and fortunately it seems fairly straightforward. But on the way I've discovered something strange. If I run this code in LB (4.5.1, but I don't think it matters) it works as expected:

Code:
    mainwin 60 30 

but if I run this code it doesn't work:

Code:
    cols = 60
    rows = 30
    mainwin cols rows 

Am I doing something stupid? Surely it must be possible to set the mainwin size to values determined at run-time? Nothing in the Liberty BASIC Docs appears to suggest otherwise, and no errors or warnings are reported either at compile or run time, but it doesn't seem to work.

Richard.
User IP Logged

BrianM
New Member
Image


member is offline

Avatar




PM


Posts: 15
xx 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.

Brian Matthews
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Variables in MAINWIN statement
« Reply #2 on: Aug 9th, 2017, 8:26pm »

on Aug 9th, 2017, 7:36pm, BrianM wrote:
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! rolleyes

Richard.
User IP Logged

BrianM
New Member
Image


member is offline

Avatar




PM


Posts: 15
xx 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.

Brian
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Variables in MAINWIN statement
« Reply #4 on: Aug 9th, 2017, 9:11pm »

on Aug 9th, 2017, 8:41pm, BrianM wrote:
"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. shocked

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls