Stan,
While I was trying to get a better handle on managing VB files at the project level I kinda got sidetracked on the VB .FRM files. I noticed the layout and definition of the event procedures are pretty well compartmentalized and that lead me to wonder if we could apply the same level of compartmentalization to the converter.
My idea was this; instead of having one callback function to handle the entire form, establish an individual callback for each control. This way we could create a template file for individual controls that could contain standard windows messages that we could plug in to the generated PB source code.
For example, the combobox control callback template might look like this:
We could then insert the VB event code between the ''##BEGIN and ''##END comments pretty much as is without having to figure out the context of the VB code and then attempting to insert it into a single callback function at the appropriate place and hope we get it right. This way the converted Vb code is associated with a Windows %WM_COMMAND or %WM_NOTIFY message and still gives the user a familiar point of departure via the VB event code procedure name. Frankly, I wish PBForms did something like this to help the users identify Windows messages and how they relate to the real world.
Anyway, just a thought.
While I was trying to get a better handle on managing VB files at the project level I kinda got sidetracked on the VB .FRM files. I noticed the layout and definition of the event procedures are pretty well compartmentalized and that lead me to wonder if we could apply the same level of compartmentalization to the converter.
My idea was this; instead of having one callback function to handle the entire form, establish an individual callback for each control. This way we could create a template file for individual controls that could contain standard windows messages that we could plug in to the generated PB source code.
For example, the combobox control callback template might look like this:
Code:
CALLBACK FUNCTION <cb-ComboBoxName> () as LONG SELECT CASE cb.msg CASE %WM_COMMAND SELECT CASE CB.CTL 'Find the individual button controls from the Visual BASIC .FRM 'file. This part of the SELECT CASE structure is built on-the-fly. CASE <comboboxid> 'Add the Command Button event messages. 'The individual control event messages can be inserted from a 'template file. SELECT CASE CB.CTLMSG CASE %CBN_CLOSEUP ''##BEGIN _CLICK() Event ''##END _CLICK() Event CASE %CBN_EDITCHANGE ''##BEGIN _CHANGE() Event ''##END _CHANGE() Event CASE %CBN_SETFOCUS ''##BEGIN _GOTFOCUS() Event ''##END _GOTFOCUS() Event CASE %CBN_KILLFOCUS ''##BEGIN _LOSTFOCUS() Event ''##END _LOSTFOCUS() Event CASE %CBN_SELCHANGE ''##BEGIN _CLICK() Event ''##END _CLICK() Event CASE %CBN_DBLCLK 'Occurs only for the CBS_SIMPLE style. ''##BEGIN _DBLCLK() Event ''##END _DBLCLK() Event CASE ELSE END SELECT CASE ELSE END SELECT CASE %WM_CLOSE CASE %WM_DESTROY CASE ELSE END SELECT END FUNCTION
Anyway, just a thought.
Comment