RE: Lua - prompt and wait for selection?
2021-09-25, 19:44 (This post was last modified: 2021-09-25, 19:47 by Roland Melkert.)
2021-09-25, 19:44 (This post was last modified: 2021-09-25, 19:47 by Roland Melkert.)
(2021-09-25, 19:11)David Manley Wrote: One idea which struck me as I was trying the diakog/selection method was would it be possible to incorporate a "select part" control within a dialog? The dialog could provide for "N" prompts via a table and a button (?) per prompt which when clicked would hide the dialog, wait for a part/sub-file to be selected and then resume displaying/operating the dialog.
I prefer to keep the api low level, this sounds very specific.
I'm thinking about extending the macro setEvent function to include some internal editor callbacks, like:
Code:
macro:setEvent('selectionChange', 'handleSelChanged')
The handleSelChanged function could then do something with the current selection when it's called, a "Select more?" confirm dialog would then be used to finish the work or repeat the selection.
Only thing I'm not sure about is when to make those callbacks, I don't want them to fire all the time.
It should somehow only be triggered when running the macro.
Maybe something like
Code:
macro:waitForEvent()
waitForEvent will not block the script, it will still run to the end, but when the selection changes it will continue trough the handleSelChanged function.