Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1998-10-10
2
Medium Priority
?
249 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 150 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

886 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