Hi,

  IupPopup starts a new message loop that will return only when one of the
following occurs: "a callback returns IUP_CLOSE, IupExitLoop is called, or
when the popup dialog is hidden, for example using IupHide".

  It looks that you are doing it right, but this: "IupHide never returns
and all following events are handled inside IupHide." Is quite weird. There
is no message processing in IupHide, but IupFlush is called. So pending
messages are processed. I noticed you have a timer, it may process the
timer and call the timer callback.

  If this does not help you find the problem, then to be able to reproduce
the problem here I'll need a small example code. For instance, you can
change one of the pre-defined samples.

  Sorry for taking so long.

Best,
Scuri



Em qua., 26 de mai. de 2021 às 14:14, Antonio Scuri <antonio.sc...@gmail.com>
escreveu:

>  Later today, I'll see this.
>
> Best,
> Scuri
>
> Em qua., 26 de mai. de 2021 às 14:12, Isaac Raway <is...@mm.st> escreveu:
>
>> Could really use some help with this. This bug is bad enough and hard
>> enough to track down I'm being forced to consider using a different
>> toolkit, which would be a ton of work and isn't really something I want to
>> do. Is there any way to figure out why these functions aren't returning as
>> documented?
>>
>> IJR
>>
>> On Thu, May 13, 2021, at 10:27 AM, Isaac Raway wrote:
>>
>> 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
>> 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
>>
>>
>> _______________________________________________
>> Iup-users mailing list
>> Iup-users@lists.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