Tab control & create form event

Started by Petrus Vorster, July 05, 2015, 05:23:48 PM

Previous topic - Next topic

Petrus Vorster

I have several forms in numerous tabs.
When the forms open the first time i have placed a procedure under the WM_create to fill a combo or a listview.
I want the user to make changes in another tab (EG settings) and when the other tab is opened, it must reload like the first time and run the procedure again as if it is the first time.
Since the forms does not "unload" again, where does one place startup procedures in a TAB-child form?

-Peter
-Regards
Peter

Nathan Durland

I usually define a user-defined message.  %WM_USER is predefined in the Win32 API as the beginning of a block of message values that our program can define and post to controls.  An old, but relevant post here:  https://powerbasic.com/support/pbforums/showthread.php?t=8096.

Something Like So:

%WM_USER_FORMSTART = %WM_USER + 1

Function FormFill() As Long

  Ff_Control_Settext HWND_FORM1_TEXT1, "Hello There"

End Function

'--------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         Byval UserData As Long _  ' optional user defined Long value
                         ) As Long

    Local xLoop      As Long

    Postmessage HWND_FORM1, %WM_USER+Formstart, 0, 0
   

End Function

'--------------------------------------------------------------------------------
Function FORM1_CUSTOM ( _
                      hWndForm      As Dword, _  ' handle of Form
                      wMsg          As Long,  _  ' type of message
                      wParam        As Dword, _  ' first message parameter
                      lParam        As Long   _  ' second message parameter
                      ) As Long


  If wMsg = %WM_USER_FORMSTART Then
    FormFill
  End If


End Function


'--------------------------------------------------------------------------------
Function FORM1_COMMAND1_BN_CLICKED ( _
                                   ControlIndex     As Long,  _  ' index in Control Array
                                   hWndForm         As Dword, _  ' handle of Form
                                   hWndControl      As Dword, _  ' handle of Control
                                   idButtonControl  As Long   _  ' identifier of button
                                   ) As Long

  Postmessage HWND_FORM1, %WM_USER_FORMSTART, 0, 0

End Function



Hope this helps







Petrus Vorster

Thanks Nathan!
I am going to try this JUST NOW!
-Regards
Peter