Peter wrote:to clear it up for me: You want to know when the Cancel button is pressed in the OpenFileRequester?
Why? I can't imagine a scenario that requires such functionality at the moment. Do you have an example for me?
Thank you for considering this, Peter.
Yes I would like to have a mechanism where cancellation event is recognized somehow.
It is not that important if user pressed cancel button or he just closed the file dialog window, the result is the same. All other 'call back' controls have error mechanism (except for handlers, but handlers would either handle event or not - and they can be chained by further callbacks)
Not imagining scenario is understandable - we usually focus on what we've seen before or intentions of how something 'shall' be used not the way how someone 'may use it'. This kind of dialog would be in a typical GUI application called perhaps as menu event (e.g. 'File, Open ...' menu item) handling loading of 'document' or not.
In my case this file dialog comes before application even starts (that is during preparation phase of the app - in other words there is no underlying app yet at the time of file dialog) and since whole execution flow goes thru chained callbacks (as that seems to be the only method available because many of involved functions there only support async way of doing things) hence handling is typically covering success and error branch (Promises?). The flow die in case user cancels selecting the file as there is no 'error' or 'cancel' branch for this one to be caught, only success path.
So in my case it is some kind of 'wizard' flow scenario that offshoots necessary controls and then, depending on what user decided on the way - the appropriate end GUI is rendered (or there is further actions/decisions to be taken)
If some of these calls have not been done in async way it could be possible to keep the control. I understand that this 'call back' flow is driven by underlying JavaScript execution engine. But, this also drives the application architecture style out of imperative waters. (and understandably There is no silver bullet.
things are as they are)
In PureBasic this part is easier as it do not depend on callbacks (code taken from PureBasic help) for the same functionality.
Code: Select all
File$ = OpenFileRequester("Please choose file to load", StandardFile$, Pattern$, Pattern)
If File$
MessageRequester("Information", "You have selected following file:" + Chr(10) + File$, 0)
Else
MessageRequester("Information", "The requester was canceled.", 0)
EndIf
Of course I do not expect that SpiderBasic would be or should be following PureBasic way of doing things (primarily due different nature of underlying executable engines).
PS skipped some but's
You will catch my drift.