|
Hi Scuri – thank you. >> You will have to do it using "iup.SetAttribute(ih, "NATIVEPARENT", hWnd)". I had already tried that and it didn’t work, but the problem was that I had pushed hWnd onto the stack as an integer. I had assumed that it would be automatically converted to the required type. When I switched to pushing it onto the stack (in my C++ code) as light-user-data, it then worked. As regards the other issues: I had been hoping that I could integrate IUP windows and dialogs with native windows and dialogs. That still seems possible but more complicated than I’d hoped. One example is this: I’d like to be able to display floating IUP windows modelessly – i.e. without preventing other interaction within my main application. I had thought that I could define callbacks into the lua script which my C++ program would call if the script needed to close its IUP windows, or update them, or whatever. However, I can’t see how to do this because the IUP windows seem to need iup.MainLoop() to be called, and doesn’t exit from that until the IUP windows close. My application assumes that it controls the main message pump (e.g. for idle-time processing). Is there any way of letting both message loops work in tandem so to speak? Simon From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Antonio Scuri Hi, You have two different problems. They have separate solutions. > I noticed that there is also a PARENTDIALOG attribute at least for IUP dialog objects. But I can’t work out how to use this either. Is it assuming that the parent dialog is another IUP dialog object? Yes, in this case the attribute points to the name of another IUP dialog. > I tried using IUP dialogs and setting the NATIVEPARENT attribute, having setup the value of my application’s main windows HWND as a (global) integer within the Lua environment. None of the ways I tried of setting the NATIVEPARENT attribute worked, and I’m not sure if that is what I’m supposed to be doing anyway. That's the solution I would give to you regarding the IUP dialogs to be in front of your native dialogs (not related to the modal problem). So probably setting the attribute failed. Since this attribute must be a pointer to the HWND, it must be an usedata in Lua. And this will not work for a regular "ih.nativeparent = hWnd" call. You will have to do it using "iup.SetAttribute(ih, "NATIVEPARENT", hWnd)". > I also tried using the SIMULATEMODAL attribute. Like PARENTDIALOG that only seems applicable to dialog objects, and not ‘Alarm’ or ‘GetParam’. But in any case, I couldn’t get it to work either. IupAlarm and IupGetParam internally use IupDialogs, but both are functions that create and show pre-defined dialogs. Usually they are configured through a callback (IupGetParam) or global attributes (IupAlarm). Although they are not NATIVEPARENT friendly. It will be not simple to use NATIVEPARENT with them, but it is possible, at least for IupGetParam. SIMULATEMODAL will automatically disable other IupDialogs so IupShow can be used. IupPopup does the same. So in both cases, they will work for IupDialogs only. So if you want IUP dialogs to be "modal" regarding the native dialogs too you will have to manually disable other native dialogs before running the script, or at least before running a script that needs that. We have two internal global callbacks that can help, they are called before and after a modal dialog is displayed, they are GLOBALENTERMODAL_CB and GLOBALLEAVEMODAL_CB. They are not available in Lua. They could be implemented in the C part of your application. Best, Scuri Em ter, 11 de jun de 2019 às 13:41, Simon Orde <SimonOrde@family-historian.co.uk> escreveu:
|