I've been playing with the
fhPromptUserForRecordSel(...) function to check my understanding of how to use the Window handle, and I'm confused...
This is the example in the plugin help
Code: Select all
require("iuplua");
iup.SetGlobal("CUSTOMQUITMESSAGE","YES");
local btn = iup.button{title="click me"};
local dlg=iup.dialog{ iup.vbox{ iup.label{title="Hello"}, btn}, title="Test Click", size="200x200"};
iup.SetAttribute(dlg, "NATIVEPARENT", fhGetContextInfo("CI_PARENT_HWND"));
function btn:action()
tblIndi = fhPromptUserForRecordSel('INDI', -1, dlg.HWND)
if #tblIndi == 0 then
fhMessageBox('User cancelled')
else
for i=1, #tblIndi do
fhMessageBox(fhGetDisplayText(tblIndi[i]), "MB_OK", "", dlg.HWND)
end
end
end
iup.Popup(dlg);
iup.Destroy(dlg);
I understand passing the handle to the Message Box, as it keeps it modal and stops the user interacting with the calling window while open (even if CP omitted this in the other call to fhMessageBox - that's an untidiness that should be reported anyway).
However, it seems to make no difference to how the plugin behaves whether I pass the Window handle to
fhPromptUserForRecordSel or not. Omit that argument, and it still behaves as a normal modal window, providing that you have set the iup 'NATIVEPARENT' attribute. The calling window is completely inactive, even though the controls are not greyed out. That's normal Windows and FH behaviour, so IMO should be kept as it is.
What's the point of passing the handle to
fhPromptUserForRecordSel? It must be for something.