Solved

How to add elements to a combobox that is inside a dialogbox

Posted on 1998-10-10
2
229 Views
Last Modified: 2010-04-02
Hi all.. I have created a Dialog Box using the resource workshop... I have 2 classes in my application... one derived from TDialog class, and the other from TApplication. TDialog constructor is used to place the dialog box on the client area of the application. I have on that dialog box, 3 sort of controls... 1 combobox, 1 progress bar, and some static texts. I can, in the program, write the static texts  using SetDlgItemText method... that is ok.... my question is: How can I add items into the combobox and how can I control the progressbar? I tried to define a TComboBox object, but it didn't work.

Any suggestion?
Thanks in advance

P.D. My programming language is BC++ 5.0
0
Comment
Question by:demarcy
2 Comments
 
LVL 6

Accepted Solution

by:
WxW earned 50 total points
ID: 1174801
I strongly suggest to use OWL objects for only the dialog creation ( TDialog) , and not associating other dialog controls with owl objects . IN your TDialog's SetupWindow , use
::SendMessage with the CB_ADDSTRING ( check the win33.hlp for the parameters that CB_ADDSTRING take ) . TO obtain the combobox handle , use GetDlgItem(xxx) xxx = the resource id of the box

With the same way you control any other control in the dialog box .All progress bar messages begin with PBM_ . ( warning , don't use PBM_ messages to OWL progress bars , only to Progress bars defined with the resource editor )
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1174802
1. About ComboBox.
You must define in you Dialog Class something as
TComboBox *tMyComboBox;
and in Setup Program:
 tMyComboBox = new TComboBox(this, ID_DROPDOWN_COMBOBOX);
BUT: (i think, that iis you problem:
ID_DROPDOWN_COMBOBOX must be same,as in
Definition of ComboBox in you Resource File!!)
For add someting in ComboBox use :

tMyComboBox->AddString("Jack");

More details in OnLine Description of TComboBox

2. In same way make Static Text:
TStatic *tMyStatic;
 tMyStatic =  new TStatic(this, ID_STATIC, LEN_TEXT);
AGAIN: See that ID_STATIC equal of ID in Resource File
3. Scroll Box: if you must scroll box for controll ComboBox,
better make ComboBox with parameter : "VerticalScroll
allways", and this will be automatically, but in sach way
as in 1./2. you cam may TScroll Class and get its messages.
Regards, Alex

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

685 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