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
Solved

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

Posted on 1998-10-10
2
223 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

790 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