Solved

Placing bitmap and textboxes in tabcontrol

Posted on 2003-10-31
8
280 Views
Last Modified: 2010-04-15
I have a window with three tab control that works fine with title for each page, i want to know how to place a bitmap, textboxes,listboxe, etc in each tabcontrol page. The window and tabcontrol pages are created using plane c, no MFC or Visual C++.
enviroment win2k,lcc-win.
0
Comment
Question by:luyaz
  • 3
  • 2
8 Comments
 
LVL 45

Expert Comment

by:Kdo
ID: 9657736

Objects are added to the tabbed notebook in the same manner as they are added to any other object.  Create the new object and make the tabbed notebook the parent.  (Sorry -- the page doesn't own the object, the notebook does.)

The tabbed notebook contains a property (field, variable, etc) called PageIndex.  When one of the tabs is clicked, walk through the objects owned by the notebook and set the object's Visible property according to whether you want the item active on the new page.

Oh, and when you first display the notebook you'll want to make sure that Visible is correctly set for each object so that the initial page displays properly.


Kent
0
 

Author Comment

by:luyaz
ID: 9665279
How about an example?
0
 
LVL 45

Expert Comment

by:Kdo
ID: 9670376

Sorry for the delay getting back to you.

Pretend that you've got a two page tabbed notebook.  The two pages are identified as "Page 1" and "Page 2".  Within the Windows system, the two pages are NOT considered objects -- they are simply items on a control.  So you cannot assign an item to a "page" of a tabbed notebook and just have it work.

Now lets add an item to each page.  "This is page 1" and "This is page 2" are labels that are added to the tabbed notebook.  When a page is displayed we want the correct label to also display.

Set the tabbednotebook's "OnClick" event to point to a function, TabbedNotebookClick().  Now code the function like this:

TMyForm::TabbedNotebookClick (TObject *Sender)
{
 
  if (TabbedNotebook->DisplayPage == 1)
  {
    TabbedNotebook->Label1->Visible = true;
    TabbedNotebook->Label2->Visible = false;
  }
  else if (TabbedNotbook->DisplayPage == 2)
  {
    TabbedNotebook->Label1->Visible = false;
    TabbedNotebook->Label2->Visible = true;
  }

As you add pages and objects, add them to the TabbedNotebookClick() method to control when the are displayed.

The tabbednotebook object has a property called "Active Page".  You can change which page is displayed from your program by setting this property to the NAME of the page that you want displayed.


Good Luck!
Kent
0
 

Author Comment

by:luyaz
ID: 9686106
Are you aware that i am using no MFC or Visual c++ its just plain c.
0
 
LVL 45

Accepted Solution

by:
Kdo earned 100 total points
ID: 9686221

That's OK.

Somewhere you had to acquire an objects library that contains the executable code for the GUI controls.

My example was C++ (Sorry -- my fault) but the same theory holds for C, too.  You just don't tie the function to the TMyForm class.


Kent
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now