didn't fly.
Code: Select all
label_title = MARK("<span color=\"red\">Color me red</span>", 50, 30)
ATTACH(mainwin, label_title, 30, 5)
Code: Select all
label_title = MARK("<span color=\"red\">Color me red</span>", 50, 30)
ATTACH(mainwin, label_title, 30, 5)
Code: Select all
# yad --text="<span color=\"red\">Color me red</span>"
Well, actually it will### Q... Is there a DirDialog to match the FileDialog? I didn`t see one.
................ The FileDialog won`t return just a path, of course.
Code: Select all
INCLUDE "/usr/share/BaCon/hug_imports.bac"
INIT
CONST Mainwin_width = 200
CONST Mainwin_height = 200
CONST Mainwin_border = 5
CONST Btn_height = 25
CONST Btn_width = 125
GLOBAL Foldername$ TYPE STRING
' =====================================================
' SETUP FILEDIALOG FOR FOLDER/DIRECTORY
' =====================================================
' ------------------
SUB OPEN_FILEDIALOG
' ------------------
SHOW(Get_folder_)
END SUB
' ------------------
SUB GET_FOLDERNAME(int Foldername_handle_, int Button_)
' ------------------
'On exit, Foldername$ = the folder/directory
HIDE(Foldername_handle_)
IF Button_ = GTK_RESPONSE_ACCEPT THEN
Foldername$ = GRAB$(Foldername_handle_)
ELSE
Foldername$ = ""
END IF
' For demo
PRINT Foldername$
' -------
END SUB
' ------------------
' ------------------
SUB MAKE_GUI
' ------------------
Mainwin_ = WINDOW("Get Folder Demo", Mainwin_width, Mainwin_height)
Get_folder_ = FILEDIALOG("Select Folder/Directory", "gtk-ok", 300, 300, 2)
Browse_btn_ = BUTTON("Browse", Btn_width, Btn_height)
ATTACH(Mainwin_, Browse_btn_, 5, 5)
CALLBACK(Browse_btn_, OPEN_FILEDIALOG)
CALLBACK(Get_folder_, GET_FOLDERNAME)
END SUB
' =====================================================
' END SETUP FILEDIALOG
' =====================================================
' ******************
LABEL MAIN
' ******************
MAKE_GUI
DISPLAY
Code: Select all
btnDnldP_ = BUTTON("Download Path",120,25)
ATTACH(tab0_,btnDnldP_,5,tabH-120)
CALLBACKX(btnDnldP_,showDLG,0)
SUB showDLG(int btnN)
SHOW(DLG_)
PRINT btnN
PRINT btnDnldP_
END SUB
sunburnt wrote:Another code Q...
The BaCon docs seem pretty clear on how to use CALLBACKX ...
Code: Select all
CALLBACKX(widget, function, value)
Type: directive
Defines a self-defined <function> where HUG should jump to when an event for <widget> occurs,
and pass <value> to that function. The arguments in the callback function should catch this value.
Example:
INCLUDE "hug.bac"
SUB demo(NUMBER widget, NUMBER value)
PRINT value
END SUB
SUB showDLG(NUMBER Handle_, int btnN)
Probably one, for each type used.# I`m trying to reuse the same FileDialog with different buttons.
....... Each button gets it`s own EntryBox filled from the FileDialog.
....... Should only need to declare/create one FileDialog, right?
# It`d be nice to be able to control the FileDialog type and WinTitle.
Code: Select all
TEXT(widget, "text")
Depending on the widget, sets the text. The current behavior is shown in the table below.
WINDOW Sets the text in the title bar
# Additional Q... Way to get a return from a Bacon exec file? Like a function?
Code: Select all
EXEC$(command$ [, stdin$])
Type: function
Executes an operating system command and returns the result to the BaCon program.
The exit status of the executed command itself is stored in the reserved variable RETVAL.
Optionally a second argument may be used to feed to STDIN. See SYSTEM to plainly execute a
system command. Example:
result$ = EXEC$("ls -l")
result$ = EXEC$("bc", CONCAT$("123*456", NL$, "quit"))
Code: Select all
FFdialog [ 0 - 3 ]
Code: Select all
IF INSTR(ARGUMENT$, " ") = 0 THEN
Style = 0
ELSE
Style = VAL(CHOP$(RIGHT$(ARGUMENT$, 1)))
END IF
Code: Select all
FF$ = CHOP$(EXEC$(Title$, "2"))