dkl
Full Member
Posts: 234
|
Post by dkl on Nov 6, 2021 19:31:46 GMT -5
Below is a sub routine someone on this Forum gave me. (I cannot remember who - sorry!). It's been altered and edited over time. sub buttonClick handle$ SearchValue=val(right$(handle$, 1)) print Let$(SearchValue) call assign A$ end sub sub assign byref A$ A$ = A$ + Let$(SearchValue) print "A$ = ";A$ sch=1:Print "sch = ";sch end sub I want to be able to 'disable' or "hide" the button associated with the relevant 'buttonClick', so that it cannot be used again until unlocked later.
As the code
#w.SearchValue, "disable"
doesn't work - it is just treated as an invalid file handle, how can I determine the button that was pressed and disable/hide the relevant button (it needs to be random)?
|
|
|
Post by Brandon Parker on Nov 6, 2021 21:00:56 GMT -5
Where are you trying to disable the button? Is it inside the Subroutine assign? If so, is A$ supposed to be part of the handle name along with the Let$() element? Is "#w" the window handle or is it contained in A$ or Let$()?
Typically, you would build the handle string like this...
winHandle$ = "#w" controlHandle$ = "btnSomeButton"
'Build the entire control's handle name myControl$ = winHandle$;".";btnSomeButton
'Use "!Disable" for a button 'Use the # sign with the myControl$ variable 'added to get LB to evaluate the it as a handle variable #myControl$ "!Disable"
{:0)
Brandon Parker
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Nov 6, 2021 21:22:45 GMT -5
The button is being disabled in the GUI.
A$ and Let$ are not relevant to anything the button code is as follows Let$() contains the letters from a random 9 letter word..... Let#(1) = "A":Let$(2) = "S" .....etc button #w.1,Let$(1), buttonClick,UL, 160, 50, w,h button #w.2,Let$(2), buttonClick,UL, 205, 100, w,h button #w.3,Let$(3), buttonClick,UL, 205, 160, w,h button #w.4,Let$(4), buttonClick,UL, 160, 210, w,h button #w.5,Let$(5), buttonClick,UL, 90, 210, w,h etc...... so if I click button #w.2, then Let$(2) if chosen and considered 'used' so 'disable or 'hide' it and so on....... word is checked for validity and then buttons are re-enabled I hope I have made myself clear. I will try with the code you have just sent me. Thanks
I have tried your code but don't see how it works with random choice as I have to assign a different 'ext' #w.1 #w.2 #w.3 etc for each button. Perhaps I'm missing something here?
|
|
|
|
Post by Brandon Parker on Nov 7, 2021 7:50:57 GMT -5
Not a problem...
{:0)
Brandon Parker
|
|