|
Post by joreveur on Jan 27, 2017 16:05:40 GMT 1
Hello Do you have a method to link 2 combobox? The content of the second depends on the choice of the first Regards.
|
|
|
Post by joreveur on Apr 2, 2017 12:55:29 GMT 1
Hi
I tried to link 2 COMBO. What I programmed works partially. The 2nd COMBO is well positioned on the right month when I choose a quarter. I would like, according to the choice of the first COMBO, to display in the 2nd COMBO, only the months corresponding to the quarter chosen. Is it possible ? Thank you
REM "Test combo liées" INCLUDE "./../lib/hug.bac" Mainwin = WINDOW("Test combobox liées", 400, 200) SUB maj_mois IF GET(combo_trimestre=0) THEN SET(combo_mois,0) IF GET(combo_trimestre=1) THEN SET(combo_mois,3) IF GET(combo_trimestre=2) THEN SET(combo_mois,6) IF GET(combo_trimestre=3) THEN SET(combo_mois,9) END SUB '---------------------------------------------------------------------- label_trimestre=MARK("trimestre",100,30) ATTACH(Mainwin,label_trimestre,10,10) combo_trimestre = COMBO("1er trimestre",140, 30 ) ATTACH(Mainwin, combo_trimestre,100, 10) TEXT(combo_trimestre,"2ème trimestre") TEXT(combo_trimestre,"3ème trimestre") TEXT(combo_trimestre,"4ème trimestre") CALLBACK(combo_trimestre, maj_mois) '---------------------------------------------------------------------- label_mois=MARK("mois",100,30) ATTACH(Mainwin,label_mois,10,50) combo_mois = COMBO("janvier",120, 30 ) ATTACH(Mainwin, combo_mois,100, 50) TEXT(combo_mois,"février") TEXT(combo_mois,"mars") TEXT(combo_mois,"avril") TEXT(combo_mois,"mai") TEXT(combo_mois,"juin") TEXT(combo_mois,"juillet") TEXT(combo_mois,"août") TEXT(combo_mois,"septembre") TEXT(combo_mois,"octobre") TEXT(combo_mois,"novembre") TEXT(combo_mois,"décembre") '---------------------------------------------------------------------- btn_quitter=BUTTON("Quitter",100,30) ATTACH(Mainwin,btn_quitter,100,150) CALLBACK(btn_quitter,QUIT) '---------------------------------------------------------------------- DISPLAY Best regards Jo.
|
|
|
Post by Pjot on Apr 2, 2017 18:00:00 GMT 1
Hi jo,
How about the below?
BR Peter
REM "Test combo liées" INCLUDE "hug.bac" Mainwin = WINDOW("Test combobox liées", 400, 200)
SUB maj_mois
' Empty the combo WHILE LEN(GRAB$(combo_mois)) SET(combo_mois, 0) TEXT(combo_mois, "") WEND
' Add entries we need SELECT GET(combo_trimestre) CASE 0 TEXT(combo_mois, "janvier") TEXT(combo_mois, "février") TEXT(combo_mois, "mars") CASE 1 TEXT(combo_mois,"avril") TEXT(combo_mois,"mai") TEXT(combo_mois,"juin") CASE 2 TEXT(combo_mois,"juillet") TEXT(combo_mois,"août") TEXT(combo_mois,"septembre") CASE 3 TEXT(combo_mois,"octobre") TEXT(combo_mois,"novembre") TEXT(combo_mois,"décembre") END SELECT
' Set the first entry in the combo SET(combo_mois, 0)
END SUB '---------------------------------------------------------------------- label_trimestre=MARK("trimestre",100,30) ATTACH(Mainwin,label_trimestre,10,10) combo_trimestre = COMBO("1er trimestre",140, 30 ) ATTACH(Mainwin, combo_trimestre,100, 10) TEXT(combo_trimestre,"2ème trimestre") TEXT(combo_trimestre,"3ème trimestre") TEXT(combo_trimestre,"4ème trimestre") CALLBACK(combo_trimestre, maj_mois) '---------------------------------------------------------------------- label_mois=MARK("mois",100,30) ATTACH(Mainwin,label_mois,10,50) combo_mois = COMBO("janvier",120, 30 ) ATTACH(Mainwin, combo_mois,100, 50) TEXT(combo_mois,"février") TEXT(combo_mois,"mars") TEXT(combo_mois,"avril") TEXT(combo_mois,"mai") TEXT(combo_mois,"juin") TEXT(combo_mois,"juillet") TEXT(combo_mois,"août") TEXT(combo_mois,"septembre") TEXT(combo_mois,"octobre") TEXT(combo_mois,"novembre") TEXT(combo_mois,"décembre") '---------------------------------------------------------------------- btn_quitter=BUTTON("Quitter",100,30) ATTACH(Mainwin,btn_quitter,100,150) CALLBACK(btn_quitter,QUIT)
|
|
|
Post by joreveur on Apr 3, 2017 8:32:52 GMT 1
Hello Peter Thank you very much. It works very well and you have found the solution. I just added maj_mois after listing every month to stay consistent. Have a good day
Jo.
|
|