ReneMiner
05-09-2020, 17:54
Many - not all- controls provide a syntax as
Control Add xxx,[...],Style,ExStyle, Call EventHandler
Where Eventhandler is the callback functions name that will handle events of that control.
Some- as ListView or Viewport offer already to assign a NAME to the controls so its simple and not necessary to append
"Call Eventhandler" explicitely because f.e."myListview_OnCallback" allows to handle the events in dedicated functions that only have to dimension local variables for the current CBCTL.
Sadly its not possible to filter the callback on a menuitem that it would allow to connect a function instantly on creation to handle
all events for that item and menu events are handled within the parenting dialog which leads to long "ladders" of
CallBack Function MainWndProc()
Local <a bunch of variables but only a few are needed to handle the current event>
Local <many of the variables are unused and only to be ready for another controls event>
Static <requires additional conditional clauses mostly because this>
Static <callback handles multiple events of different controls>
select case message
case messageX
select case object
case objectY
select case ...
Situation so far...
now questions:
...
Menu Add String hDlg, hMenu, "text", %IDM_myMenuItem, %MF_Enabled
-no controls name that will enable "_OnCallback" nor call-syntax to assign a function to it-
How can a apply a functions name to handle events for this menuitem only?
How to tell thinBasic to call a dedicated callback function for this menuitem?
Control Add xxx,[...],Style,ExStyle, Call EventHandler
Where Eventhandler is the callback functions name that will handle events of that control.
Some- as ListView or Viewport offer already to assign a NAME to the controls so its simple and not necessary to append
"Call Eventhandler" explicitely because f.e."myListview_OnCallback" allows to handle the events in dedicated functions that only have to dimension local variables for the current CBCTL.
Sadly its not possible to filter the callback on a menuitem that it would allow to connect a function instantly on creation to handle
all events for that item and menu events are handled within the parenting dialog which leads to long "ladders" of
CallBack Function MainWndProc()
Local <a bunch of variables but only a few are needed to handle the current event>
Local <many of the variables are unused and only to be ready for another controls event>
Static <requires additional conditional clauses mostly because this>
Static <callback handles multiple events of different controls>
select case message
case messageX
select case object
case objectY
select case ...
Situation so far...
now questions:
...
Menu Add String hDlg, hMenu, "text", %IDM_myMenuItem, %MF_Enabled
-no controls name that will enable "_OnCallback" nor call-syntax to assign a function to it-
How can a apply a functions name to handle events for this menuitem only?
How to tell thinBasic to call a dedicated callback function for this menuitem?