Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-10-10
2
Medium Priority
?
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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++.

715 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