There seems to be some sort of prohibition for using handle variables in control definition statements. For example:
hw$="WIN"
hc$=hc$+".txt"
statictext #hc$, "This is text", x, y, w, h
open "Test Window" for window as #hw$
where x, y, w, h are previously set variables, gives me compile errors on both the statictext and open statements. Replacing the handle variables with literal handles works fine. I can't find any restrictions in either the LB4 or LBB documentation ... but that doesn't mean it isn't there of course. Enlightenment, or a pointer to enlightenment, would be welcome. Best regards
Handle variables in control definition statements
Re: Handle variables in control definition statements
If you read the 'Handle Variables' section of the LB4 documentation all should be revealed. There are a number of mistakes in your code:
- The first line should be hw$="#WIN". I know that is effectively a duplication of the hash character, but that's how handle variables work.
- The second line should be hc$=hw$+".txt". I suspect your original is simply a typo.
- Most importantly, in LB4 Handle Variables are only used to reference windows and controls after creation; in LBB it is possible to use them when creating a control but only by using the MAPHANDLE statement.
Code: Select all
nomainwin
hw$ = "#WIN"
hc$= hw$ + ".txt"
textbox #tmp.txt, 10, 10, 280, 200
open "Test Window" for window as #tmp
maphandle #tmp.txt, hc$
maphandle #tmp, hw$
#hw$ "trapclose [quit]"
#hc$ "This is some new text in the textbox"
wait
[quit]
close #hw$
end
Re: Handle variables in control definition statements
OK, thanks a bunch. That seems to have fixed that part of my problem ... I say "seems" because I've got at least one other problem getting the code to run which I'm sure is pilot error too.