PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

How to add new tabs to tabcontrol?

Smok Wawelski · 17 Jun 2005, 10:19 UTC
How to add new tabs to tabcontrol? Form builder allows only to create signle tab tabcontrol.

Where could I find more informations about creating component interfaces (please, don't mention MSDN).
Smok,

Take a look at what I did on the properties page of the Visual Form Builder for the PPC. In the VFB.PPL file find "proc EditProperties" that is where the dialog is created. After the dialog creation, you will see code that adds and names the tabs.

I add a list box for each tab then hide all but the one for the selected tab. That ListBox is initialized when the tab is created, then sized to fit the space in the tab control.

Notification events come into the WinProc for the dialog (look in the ControlEdit.FRM file or the compiled ControlEdit.PPL file) and the two main messages are TCN_SELCHANGE and TCN_SELCHANGEING. One hides the last ListBox and one shows the newly selected ListBox that is for the Tab that was selected.

TabControls are really a lot of work. I hope this helps.

bmanske
Smok Wawelski · 17 Jun 2005, 12:36 UTC
Thanks for this info.

I'm just looking for a good solution to make multi-screen application (which will display various sections of simple database). I found tabcontrol to be usefull for this, but maybe there's better/simplier way? Maybe showing/hiding some components (ie. buttons or/and memos) would have the same functionality?

Let's imagine we have to build a calculator which should have simply interface and scientific interface. How would you design this? Is GROUP component usefull for this? Or just "grouping" them virtually and showing/hiding components would be better?

sw
Smok,

Knowing only what you have written so far, I think I would create a calculator with a new FRM file for each mode or "face" that you want to present to the user.

Create a FRM for each mode. In each FRM be consistant about where you place the Menu entries to change modes. Create the engine to make the calculations in the Main Files (not associated with any particular form). Declare all of the shared data in the main files so that it persists across the entire application.

Then you should easily be able to open a new form and close the original one. Even easier would be to create the forms and bring the one that you want to the top. This may eat up quite a few resources and may slow things down if you are updating the other pages in the background.

I created a quick example of using 2 windows when I was testing. I'm attaching it as it may give you some ideas.

I hope that his helps you out.

bmanske
Attachments:
TwoWin.zip (5 KB)
Smok Wawelski · 20 Jun 2005, 18:40 UTC
Thanks. This is very usefull.

regards, sw