Solved

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

Posted on 1998-10-10
2
199 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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

728 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

8 Experts available now in Live!

Get 1:1 Help Now