Liberty BASIC Community Forum
« graphicbox parameters »

Welcome Guest. Please Login or Register.
Jan 23rd, 2018, 7:29pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: graphicbox parameters  (Read 88 times)
laboyd2
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx graphicbox parameters
« Thread started on: Jan 6th, 2018, 06:47am »

Using 4.5.1 on windows 10

I am experiencing a problem using named constants in a graphicbox parameter list. A short program to show problem:

This works great with numeric parameters
Quote:
graphicbox #Main.A, 5, 20, 165, 18
graphicbox #One.B, 5, 20, 165, 18

menu #Main ,"Windows"_
,"Open One ",openOne

UpperLeftX = 100: UpperLeftY = 100
WindowWidth = 450: WindowHeight = 155
open "Binary Math" for window as #Main
call ShowLabel "#Main.A", "Main Window"

wait

sub openOne
UpperLeftX = 100: UpperLeftY = 250
open "Window One" for window as #One
call ShowLabel "#One.B", "No 1 Window"
end sub

sub ShowLabel handle$,value$
#handle$, "cls; set 2 12 "
#handle$, "font Courier_New 10 17"
#handle$, "\";value$
end sub


When I place a named constant in the parameter list for the #Main window it also works fine.
Quote:
rowA = 20
graphicbox #Main.A, 5, rowA, 165, 18
graphicbox #One.B, 5, 20, 165, 18


However when I try the same thing for the secondary window #one I have a problem
Quote:
rowA = 20
graphicbox #Main.A, 5, 20, 165, 18
graphicbox #One.B, 5, rowA, 165, 18

when I open the secondary window I get a box with:
Quote:
Please Note:
#Main
These handles closed by Liberty BASIC
Please add the appropriate CLOSE commands

When I acknowledge this it uncovers a box with
Quote:
Warning
Runtime Error: index: 1 is outside of collection bounds
(see error.log for more information)

acknowledge this results in Liberty BASIC being closed
The error.log doesn't help me
User IP Logged

tsh73
Board Moderator

member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1732
xx Re: graphicbox parameters
« Reply #1 on: Jan 6th, 2018, 09:03am »

Hello laboyd2
if you run your program in debug mode, you'll see that it stops on open second window.
That is, in the
sub openOne
So variable rowA is not accessible here.

If you make it accessible - make it global, or define (redefine) it in
sub openOne
it will work.
(btw if you redefine it with different value it'll use it.)
« Last Edit: Jan 6th, 2018, 09:04am by tsh73 » User IP Logged

damned Dog in the Manger
laboyd2
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: graphicbox parameters
« Reply #2 on: Jan 6th, 2018, 11:50am »

I had not thought about making the variable global. That fixed it.
Thank you.
User IP Logged

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

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls