|
Post by jarychk on Jul 21, 2022 4:29:32 GMT
Here is some example trying to change the string value in one particular or any particular array variable used with a combobox, and this is not working.
I just am trying to learn how to pick a item from combobox control, and change the value (string) to some different or altered name, and find the combobox show the array with the change made to one of its variables.
dim samples$(20) collection$="kingdom phylum class order family genera species" ' i=0 pull$="?" while pull$<>"" i=i+1 pull$=word$(collection$,i) sample$(i)=pull$ wend ' for j=1 to i print sample$(j) next j
'nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
combobox #main.combobox1, sample$(, [combobox1DoubleClick], 38, 46, 144, 100 textbox #main.textbox2, 222, 41, 120, 25 button #main.button3, "to change", [button3Click], UL, 222, 116, 122, 25 button #main.button4, "to remove", [button4Click], UL, 222, 156, 122, 25 open "combobox study" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
wait
[quit.main] Close #main END
[combobox1DoubleClick] 'Perform action for the combobox named 'combobox1' 'Insert your own code here #main.combobox1,"selection? id" #main.combobox1,"contents? picked$" print #main.textbox2,picked$ wait
[button3Click] 'Perform action for the button named 'button3' 'Insert your own code here prompt "Make a different name to replace that?"; newname$ if picked$<>"" then sample$(id)=newname$ 'need to reload the combobox to see new array #main.combobox1,"reload" notice "progressing" for j=1 to i print sample$(j) next j end if wait
[button4Click] 'Perform action for the button named 'button4' 'Insert your own code here wait
|
|
|
Post by zzz000abc on Jul 21, 2022 5:24:14 GMT
just you have to change one line replace '#main.combobox1,"selection? id" with #main.combobox1,"selectionindex? id " everything will be fine.
dim samples$(20) collection$="kingdom phylum class order family genera species" ' i=0 pull$="?" while pull$<>"" i=i+1 pull$=word$(collection$,i) sample$(i)=pull$ wend ' for j=1 to i print sample$(j) next j
'nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
combobox #main.combobox1, sample$(, [combobox1DoubleClick], 38, 46, 144, 100 textbox #main.textbox2, 222, 41, 120, 25 button #main.button3, "to change", [button3Click], UL, 222, 116, 122, 25 button #main.button4, "to remove", [button4Click], UL, 222, 156, 122, 25 open "combobox study" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
wait
[quit.main] Close #main END
[combobox1DoubleClick] 'Perform action for the combobox named 'combobox1' 'Insert your own code here #main.combobox1,"selectionindex? id " #main.combobox1,"contents? picked$" print #main.textbox2,picked$ wait
[button3Click] 'Perform action for the button named 'button3' 'Insert your own code here prompt "Make a different name to replace that?"; newname$ if picked$<>"" then sample$(id)=newname$ 'need to reload the combobox to see new array #main.combobox1,"reload" notice "progressing" for j=1 to i print sample$(j) next j end if wait
[button4Click] 'Perform action for the button named 'button4' 'Insert your own code here wait
|
|
|
Post by jarychk on Jul 21, 2022 6:30:39 GMT
zzz000abc, I made the change to that one line of code. Still not working!! The array changes but the combobox will not show the change. I DO have a "reload" code line, so I do not understand why the combobox will not reload.
-----
WAIT, WAIT! The contents INSIDE THE COMBOBOX listing is reloading but the element shown in the top combobox text display does not show the change.
I post the current code now here, just for update assurance of the current sample program:
dim samples$(20) collection$="kingdom phylum class order family genera species" ' i=0 pull$="?" while pull$<>"" i=i+1 pull$=word$(collection$,i) samples$(i)=pull$ wend ' for j=1 to i print samples$(j) next j
'nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
combobox #main.combobox1, samples$(, [combobox1DoubleClick], 38, 46, 144, 100 textbox #main.textbox2, 222, 41, 120, 25 button #main.button3, "to change", [button3Click], UL, 222, 116, 122, 25 button #main.button4, "to remove", [button4Click], UL, 222, 156, 122, 25 open "combobox study" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
wait
[quit.main] Close #main END
[combobox1DoubleClick] 'Perform action for the combobox named 'combobox1' 'Insert your own code here '#main.combobox1,"selection? id" 'jb member zzz000abc telling to make the change to #main.combobox1,"selectionindex? id" #main.combobox1,"contents? picked$" print #main.textbox2,picked$ wait
[button3Click] 'Perform action for the button named 'button3' 'Insert your own code here prompt "Make a different name to replace that?"; newname$ if picked$<>"" then samples$(id)=newname$ 'need to reload the combobox to see new array #main.combobox1,"reload" notice "progressing" for j=1 to 7 print samples$(j) next j end if wait
[button4Click] 'Perform action for the button named 'button4' 'Insert your own code here wait
|
|
|
Post by jarychk on Jul 21, 2022 6:49:29 GMT
I have this part of the study now. Reloads the combobox, and changes the chosen item in the combobox text field to show the changed item:
dim samples$(20) collection$="kingdom phylum class order family genera species" ' i=0 pull$="?" while pull$<>"" i=i+1 pull$=word$(collection$,i) samples$(i)=pull$ wend ' for j=1 to i print samples$(j) next j
'nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
combobox #main.combobox1, samples$(, [combobox1DoubleClick], 38, 46, 144, 100 textbox #main.textbox2, 222, 41, 120, 25 button #main.button3, "to change", [button3Click], UL, 222, 116, 122, 25 button #main.button4, "to remove", [button4Click], UL, 222, 156, 122, 25 open "combobox study" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
wait
[quit.main] Close #main END
[combobox1DoubleClick] 'Perform action for the combobox named 'combobox1' 'Insert your own code here '#main.combobox1,"selection? id" 'jb member zzz000abc telling to make the change to #main.combobox1,"selectionindex? id" #main.combobox1,"contents? picked$" print #main.textbox2,picked$ wait
[button3Click] 'Perform action for the button named 'button3' 'Insert your own code here prompt "Make a different name to replace that?"; newname$ if picked$<>"" then samples$(id)=newname$ 'need to reload the combobox to see new array #main.combobox1,"reload" 'And want textfield of combobox display to show as empty #main.combobox1,"select ";newname$ notice "progressing" for j=1 to 7 print samples$(j) next j end if wait
[button4Click] 'Perform action for the button named 'button4' 'Insert your own code here wait
|
|
|
Post by jarychk on Jul 21, 2022 9:08:03 GMT
The button3Click branch needs to be changed to this for the previous sample:
[button3Click] 'Perform action for the button named 'button3' 'Insert your own code here prompt "Make a different name to replace that?"; newname$ if picked$<>"" and newname$<>"" then 'tricky conditions for decision samples$(id)=newname$ 'need to reload the combobox to see new array #main.combobox1,"reload" 'And want textfield of combobox display to show as empty #main.combobox1,"select ";newname$ notice "progressing" for j=1 to 7 print samples$(j) next j end if wait
|
|
|
Post by jarychk on Jul 22, 2022 4:30:36 GMT
|
|