|
Post by ptitjoz on Mar 7, 2019 19:28:42 GMT 1
Hello I am trying to use the FILEDIALOG function.
fd=FILEDIALOG("choix fichier", "gtk-open", 0, 0, 0)
I can open the dialog window to choose a file but I do not know how to interact with the cancel and open buttons Do you have an example?
thanks for your advices Best regards
Attachments:
|
|
|
Post by Pjot on Mar 8, 2019 10:05:35 GMT 1
Bonjour ptitjoz, You have to define a callback to the dialog and capture the information from the file dialog in the callbacked function. There is an example on the BaCon website which can show you how it works. HTH Peter
|
|
|
Post by ptitjoz on Mar 8, 2019 14:37:19 GMT 1
Bonjour Peter !
Thank you for your answer and for the link of your example. I tried to simplify to suit my needs. Here is the code of a test program. Do you see things that are not correct? Thank you and see you soon ! Regards REM Program pour tester la fonction Dialogbox 'Ptitjoz 08/03/2019
INCLUDE "hug.bac"
SUB subfd(NUMBER widget, int button) IF button IS GTK_RESPONSE_CANCEL THEN TEXT(mark2,"Opération annulée") ELSE fichier$ = GRAB$(widget) TEXT(mark2,"Fichier sélectionné : "&fichier$) ' ici on fera le traitement du fchier en écriture END IF HIDE(fd) : ' cacher boite de dialogue des fichiers END SUB
SUB subfdshow SHOW(fd) : ' afficher boite de dialogue des fichiers END SUB
win1 = WINDOW("Test Dialogbox", 900, 500)
fd=FILEDIALOG("choix fichier", "gtk-save", 100, 100, 1) CALLBACK(fd,subfd) mark1=MARK("Test pour sélectionner ou créér un fichier",300,28) ATTACH(win1, mark1, 200, 100) mark2=MARK("",900,28) ATTACH(win1, mark2, 200, 120) button1=STOCK("gtk-save", 96, 28) ATTACH(win1, button1, 10, 400) CALLBACK( button1,subfdshow) button2=STOCK("gtk-quit", 96, 28) ATTACH(win1, button2, 110, 400) CALLBACK( button2,QUIT) DISPLAY
|
|
|
Post by Pjot on Mar 8, 2019 19:46:01 GMT 1
Hi ptitjoz, It seems you got the idea Cordialement, Peter
|
|
|
Post by ptitjoz on Mar 9, 2019 11:36:38 GMT 1
thank you so much ! have a good week-end
|
|