I should clarify that the callback below is on CLOSE_CB as well as ACTION of 
the OK button on the form. When I close the dialog box with the windows close 
button, it works correctly (callback is fired, and IupPopup returns, where the 
data is saved). But it does *not* work when clicking the OK button -- IupHide 
never returns and all following events are handled inside IupHide.

I tried removing the event callback from CLOSE_CB but the result is the same 
when clicking the OK button:

> stonenotes_nt.exe!win_dialog_ok_cb(Ihandle_ * self) Line 125 C 
[External Code]
stonenotes_nt.exe!win_dialog_show(const char * id, const char * ledFilename, 
int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *) value_callback, void 
* data) Line 120 C
stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
[External Code]
stonenotes_nt.exe!win_dialog_ok_cb(Ihandle_ * self) Line 133 C
[External Code]
stonenotes_nt.exe!win_dialog_show(const char * id, const char * ledFilename, 
int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *) value_callback, void 
* data) Line 120 C
stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
[External Code]
stonenotes_nt.exe!main(int argc, char * * argv) Line 136 C++
[External Code]


Also here is the dialog setup code in case that helps:


tWIN_DIALOG *win_dialog_show(const char *id, const char *ledFilename, Icallback 
callback, dialog_value_callback value_callback, void *data) 
{
    tWIN_DIALOG *result = calloc(1, sizeof(tWIN_DIALOG));
    Ihandle *config = get_config();
    sds attr;
    int immediate_show = 0;
    int x = 0, y = 0;

   char *error = sys_load_led(ledFilename); // this function calls IupLoad and 
returns the result after locating the file
    if (NULL == error) {
        sds key = NULL;

        // get handles from loaded LED file
        result->ok = IupGetHandle(key = sdscatfmt(sdsempty(), "IDC_%s_OK", id));
        sdsfree(key);

        result->cancel = IupGetHandle(key = sdscatfmt(sdsempty(), 
"IDC_%s_CANCEL", id));
        sdsfree(key);

        result->dlg = IupGetHandle(key = sdscatfmt(sdsempty(), "IDD_%s", id));
        sdsfree(key);
    } else {
        result->dlg = IupSetAttributes(IupDialog(IupLabel(error)), 
"TITLE=\"StoneNotes Dialog Load - ERROR\", SIZE=400x200, EXPANDCHILDREN=YES, 
RESIZE=YES");
    }

    IupSetAttribute(result->dlg, "MINBOX", "NO");

    //IupSetCallback(result->dlg, "CLOSE_CB", (Icallback)win_dialog_ok_cb);
    //IupSetAttribute(result->dlg, "WIND", (char *)result);

    IupSetCallback(result->ok, "ACTION", (Icallback)win_dialog_ok_cb);
    IupSetAttribute(result->ok, "WIND", (char *)result);

    IupSetCallback(result->cancel, "ACTION", (Icallback)win_dialog_cancel_cb);
    IupSetAttribute(result->cancel, "WIND", (char *)result);

    // .. snip .. removed additional elements on the form

    IupPopup(result->dlg, IUP_CENTER, IUP_CENTER);
    return result;
}

IJR

On Wed, May 12, 2021, at 12:31 PM, Isaac Raway wrote:
> For some reason I've noticed that calls to IupPopup have stopped returning.
> 
> My dialogs have a callback for CLOSE_CB like this:
> 
> int win_dialog_ok_cb(Ihandle *self)
> {
>     tWIN_DIALOG *dialog = (tWIN_DIALOG *)IupGetAttribute(self, "WIND");
>     Ihandle *config = get_config();
>     sds val;
> 
>     dialog->ok_clicked = 1;
> 
>     IupHide(dialog->dlg);
> 
>     return IUP_DEFAULT;
> }
> 
> 
> This has always worked before, but now it seems that the IupHide call enters 
> a new loop which processes events from my main window.
> 
> I tried returning IUP_CLOSE instead and commenting out IupHide, but the loop 
> appears to be entered instead after the callback returns.
> 
> [External Code] 
> ... snip, below is a IUP timer callback ..
> stonenotes_nt.exe!win_ipc_timer(Ihandle_ * self) Line 4203 C
> [External Code]
> > stonenotes_nt.exe!win_dialog_show(const char * id, const char * 
> > ledFilename, int(*)(Ihandle_ *) callback, int(*)(WIN_DIALOG *, void *) 
> > value_callback, void * data) Line 120 C
> stonenotes_nt.exe!win_options_categories(Ihandle_ * self) Line 2748 C
> [External Code]
> stonenotes_nt.exe!main(int argc, char * * argv) Line 136 C++
> [External Code]
> 
> 
> My win_dialog_show function is what calls IupPopup. This function is never 
> returned to, the rest of the execution happens inside the IupPopup call (2nd 
> External Code above).
> 
> Any ideas why this would have changed?
> 
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net <mailto:Iup-users%40lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/iup-users
> 
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to