|
Post by ptitjoz on Apr 16, 2019 11:24:31 GMT 1
Hello
1) I did not find how to have the dimensions of a combo.
2) how to refer to an element of the combo other than by GRAB$(Combo1)?
3) How to reset a combo?
If I added elements in a combo and I want to go back to the initial state how to do? My method does not really please me..
Best Regards
INCLUDE "hug.bac"
SUB SubAddCombo INCR x TEXT(Combo1,STR$(x)) END SUB
SUB SubResetCombo WHILE x>2 TEXT(Combo1,"") DECR x WEND END SUB
Form1=WINDOW("Form1",400,350) Combo1= COMBO("ALL",200,30 ) ATTACH(Form1,Combo1, 110, 60) TEXT(Combo1,"one") TEXT(Combo1,"two") x=2
Button1=BUTTON("AddCombo",100,25) ATTACH(Form1,Button1,50,20) CALLBACK(Button1,SubAddCombo)
Button2=BUTTON("ResetCombo",100,25) ATTACH(Form1,Button2,250,20) CALLBACK(Button2,SubResetCombo)
DISPLAY
|
|
|
Post by vovchik on Apr 16, 2019 13:03:57 GMT 1
Dear ptitjoz, I think I posted a solution in 2017 ( combo). With kind regards, vovchik
|
|
|
Post by ptitjoz on Apr 16, 2019 16:02:35 GMT 1
Thank you vovchik for that answer .
I see that it's not intuitive ...
I'm going to settle for that
Best Regards
|
|
|
Post by bigbass on Apr 16, 2019 18:50:57 GMT 1
Hello ptitjoz you can try this www.basic-converter.org/hug-tutorial/BaCon_widget_Examples_Documentation.html#DYNAMIC-COMBOJoe I adjusted another dynamic demo below ' dynamic-combobox2.bac
' Include the files for making a GUI. INCLUDE "hug.bac"
' we want to "echo out" which Combobox_selected$ was pressed
SUB combo_choices_demo Combobox_selected$ = GRAB$(combo_choices) PRINT Combobox_selected$ END SUB
' 1.) Create your main working window, 250 pixels wide x 130 pixels high Mainwin = WINDOW( "BaCon combobox", 250, 130 )
Menu_label = MARK("Select an option from the Menu" , 220, 30) ATTACH( Mainwin, Menu_label, 5, 0 )
result_input$ = EXEC$("ls /usr/share/icons")
'----------------- SUB MAKE_FILE_LIST '-----------------
SPLIT result_input$ BY NL$ TO words$ SIZE dim
FOR i = 0 TO dim - 1 combo_choices_text$ = words$[i] IF combo_choices_text$ = "" THEN DECR i PRINT "Total real numbers in list adjusted = " , i = i+1 BREAK END IF
TEXT(combo_choices, words$[i]) PRINT words$[i] ," ",i NEXT '---array starts at zero adjust count for loop exit END SUB
combo_choices = COMBO("Select a name", 180, 30 )
MAKE_FILE_LIST
ATTACH(Mainwin, combo_choices,5, 30) CALLBACK(combo_choices, combo_choices_demo)
DISPLAY
|
|
|
Post by ptitjoz on Apr 16, 2019 19:40:50 GMT 1
Thanks you it's nice! I tried it ! it's works
With my best regards
|
|