|
Post by meerkat on Aug 15, 2020 7:21:44 GMT -5
Using lb5 and windows 10.
I have textboxes defined as; textbox #mnt.tb1, 256,030,260,030 textbox #mnt.tb2, 256,060,260,030
Trying to change the value of #mnt.tb1, you cannot change it from a array. ---- This works ----- x$ = boxValue$(i) #mnt.tb1 x$ #mnt.tb2 "TEST"
---- This does not work ---- #mnt.tb1 boxValue$(1)
Is this a bug or a feature??
Thanks for the help.. Dan
|
|
|
Post by Carl Gundel on Aug 15, 2020 9:15:50 GMT -5
Using lb5 and windows 10. I have textboxes defined as; textbox #mnt.tb1, 256,030,260,030 textbox #mnt.tb2, 256,060,260,030 Trying to change the value of #mnt.tb1, you cannot change it from a array. ---- This works ----- x$ = boxValue$(i) #mnt.tb1 x$ #mnt.tb2 "TEST" ---- This does not work ---- #mnt.tb1 boxValue$(1) Is this a bug or a feature?? Thanks for the help.. Dan I think you can call this a bug by design. The trouble is that LB tries to interpret boxValue$() as a message to the textbox object, since these are resolved dynamically. So I think I may be able to have a compiler warning for this, or maybe I can do even better than that. In the meantime you can disambiguate for the compiler like so: #mnt.tb2 "";boxValue$(i) 'make it clear to the compiler that we are not sending a message to #mnt.tb2
|
|
|
Post by meerkat on Aug 15, 2020 11:12:36 GMT -5
Thanks Carl.
As long as I know the syntax, there's no problem with the way you suggest. Maybe there is a way to take advantage of this syntax?
I'm writing a fairly large program using LB5. About 4200 lines. For a Alpha release, I've had only a few problems.
Dan
|
|
|
Post by Brandon Parker on Aug 15, 2020 11:25:45 GMT -5
Carl, Since arrays are specified prior to compilation, could you not just automatically add the ""; to any array that is found after a control's identifier? I mean if the compiler knows what the arrays are then it should be able to handle this situation easily I would think.
{:0)
Brandon Parker
|
|
|
Post by Carl Gundel on Aug 15, 2020 11:41:28 GMT -5
Carl, Since arrays are specified prior to compilation, could you not just automatically add the ""; to any array that is found after a control's identifier? I mean if the compiler knows what the arrays are then it should be able to handle this situation easily I would think. {:0) Brandon Parker Thanks. Yes of course, but the compiler wouldn't need to add a ""; into the code. It would simply produce different output when it saw the array reference. I'm surprised I haven't already addressed this. The design of this extension the LB syntax has a built in ambiguity. I think a fitting way to mitigate this should be a compiler warning. It'll be okay I think.
|
|
|
Post by Brandon Parker on Aug 15, 2020 20:16:50 GMT -5
I think a fitting way to mitigate this should be a compiler warning. It'll be okay I think. But, why would assigning a string array value to a TextBox cause a compiler warning when assigning a string variable...unless I am misunderstanding what the OP was stating? OP's remarks From that description, the OP is stating that something like this causes an issue. I do not understand why this would be a compiler warning. myArray$(0) = "Hello World!"
TextBox #Main.txt1, 50, 50, 100, 25 Open "Test" For Window As #Main #Main "TrapClose Quit" 'This is where the description above would cause the issue #Main.txt1 myArray$(0) Wait
Sub Quit handle$ Close #handle$ End End Sub And indeed when I run it LB5 v351 definitely breaks when trying to assign an array element directly to a TextBox. Not allowing this as "normal" would be a mistake in my mind as well as a departure from LB4.xx. {:0) Brandon Parker
|
|
|
Post by Carl Gundel on Aug 16, 2020 8:49:46 GMT -5
I think a fitting way to mitigate this should be a compiler warning. It'll be okay I think. But, why would assigning a string array value to a TextBox cause a compiler warning when assigning a string variable...unless I am misunderstanding what the OP was stating? The idea of the compiler warning is that if is any ambiguity that can be detected, then the compiler would make mention of it. I haven't figure that part out yet.
|
|
|
Post by Brandon Parker on Aug 16, 2020 9:14:47 GMT -5
Right, shouldn't a warning for "ambiguity" only be required if the array name could be mistaken for something else such as a control command? I mean if the array name is unique and the compiler already knows the arrays in use and can assign the value of the array element to the control then there should be no ambiguity regarding what is expected to be done.
I'm not trying to argue, I just do not see the issue...
{:0)
Brandon Parker
|
|