Navigation:  thinBasic Modules > UI (User Interface) > CONTROLs > Dedicated Control Functions > TAB Control >

TAB automatic handling events

Previous pageReturn to chapter overviewNext page

 

TAB automatic handling events

 

To simply some common tasks when using TAB that usually would require many lines of code, thinBasic has developed few automatic event handling  functions.

Just one line of code substitute a lot of struggling when using TAB controls.

 

3 are the events handled by those functions:

 

1.Resizing
When a TAB control is resized, all sub windows inside each TAB page must be resized.
In this case just add TAB_OnResize function to %WM_SIZE event and all the job will be done automatically
 
2.Notify
When a TAB page is selected, usually the job to be done is to hide the window connected to the previously selected Tab page and show the window associated to the new Tab page.
In this case just add TAB_OnNotify function to %WM_NOTIFY event and the above duty will be done by thinBasic engine
 
3.Destroy
When TAB control is desroyed, all the windows associated with the Tab pages must be destroyed either.
In this case just add TAB_OnDestroy function to %WM_DESTROY event to have the job done.

 

 

Example: the following example show a typical dialog callback where %ID_TAB represent a TAB control placed over the window.

 

  '----------------------------------------------------------------------------

  CALLBACK Function cb_Main()

  '----------------------------------------------------------------------------

 

    '---Test the message

    Select Case CBMSG

 

      '---Message fired at the very beginning when dialog is initialized

      Case %WM_INITDIALOG

 

 

      Case %WM_SIZE

        Tab_OnResize(CBHNDL%ID_Tab)

 

      Case %WM_DESTROY

        Tab_OnDestroy(CBHNDL%ID_Tab)

 

      Case %WM_NOTIFY

 

        '---Check which control fired notificatin message

        Select Case CBCTL

          Case %ID_Tab

            Tab_OnNotify(CBHNDL%ID_TabCBLPARAM)

        End Select

 

    End Select

 

  End Function

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com