|
Hi I use LUA as an embedded scripting language to support user-created plugins within my Windows Visual C++ application. I want my users to be able to display IUP windows and dialogs within a LUA plugin. My application has windows and dialogs of its own. If I run a Lua plugin that displays any kind of dialog (e.g. by using iup.GetParam or iup.Alarm say), the IUP Help for both GetParam and Alarm says that they will display a “modal dialog”. However, the dialog that is displayed is not modal – or not at least with respect to my other windows and dialogs. All the existing windows and dialogs within my application continue to be accessible and enabled, and if I click on any one of them, the IUP dialog will disappear behind my application window. The only way I can prevent this is to disable all my application windows and dialogs before running the plugin, and re-enable them afterwards. However, that is not a good solution for me for a number of reasons – not least that it doesn’t fully prevent the IUP dialog accidentally ending up behind my application windows. It just makes it less likely to happen by the user clicking on one of my windows. I would like to find some way of making IUP dialogs properly modal with respect to my other application windows. I would also like to find some way of supporting IUP windows that are not modal, but nevertheless float in front of my other application windows – and without having to make them always-on-top type of windows. 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. 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? 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. E.g. I tried this: require( "iuplua" ) vbox = iup.vbox { iup.label {title="Label"}, iup.button { title="Test" } } dlg = iup.dialog{vbox; title="Dialog", SIMULATEMODAL=true} dlg:show() if (iup.MainLoopLevel()==0) then iup.MainLoop() end That doesn’t work. All help with this very much appreciated – especially actually lua code examples! Thank you. Simon |