I have created a toolbar with a button using XUI dialog boxes. The button and the toolbar are displayed successfully but the command associated with the button doesn't work? Can you help me ?
code fragments:
function _init1(win = current_window())
{
if (window_state(win) < 0) {
response("Invalid window $win")
return
}
local doc = window_doc(win)
if (!doc_valid(doc)) {
response("Invalid document")
return
}
local dirPath=dirname(doc_path(doc));
dirPath=$dirPath . "dialogs\\toolbar_InsertRevisionTags.xml"
dirPath=absolute_file_name($dirPath);
append_dialogs_path(dirPath, 1);
if (!dlgitem_exists(win, 'toolbar_InsertRevisionTags')) {
window_load_component_file(win, 'toolbar_InsertRevisionTags.xml')
}
ret=dlgitem_add_callback(win ,'button_InsertRevisionTags', 'attach_callback');
}
#function 'attach_callback'
function attach_callback(win, dlgitem, event, data, appdata)
response("ok")
}
Solved! Go to Solution.
Do you have a typo? There is no open { associated with function attach_callback() toward the end of your code.
In addition to the strategy you're using, I use this one, too: I attach the command directly to the <button> element in the XUI. For example:
<button command="mypackage::myfunction()" id="mybutton" image="myimg" tiptext="mytiptext">
Then mypackage just has to be sourced before the button is clicked and beep beep pow, it works.
Do you have a typo? There is no open { associated with function attach_callback() toward the end of your code.
In addition to the strategy you're using, I use this one, too: I attach the command directly to the <button> element in the XUI. For example:
<button command="mypackage::myfunction()" id="mybutton" image="myimg" tiptext="mytiptext">
Then mypackage just has to be sourced before the button is clicked and beep beep pow, it works.
Thank you for your help.
Ok for the missing character "{". It's just an error when I wrote the discussion.