Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CTabCtrl : How to use the control boxes

Posted on 2003-11-30
4
Medium Priority
?
503 Views
Last Modified: 2013-11-20
Hi
I build a TabCtrl using the following CTabCtrl Class.

http://www.codeguru.com/controls/CMyTabCtrl.html

I use the Visual C++ 6.0 .

Now after making and attaching the child dialog boxes to the main dialog boxes i am facing the following problems:

1. The "&" sign that i used in the various texts does not show up even though the dialog boxes have been attached.

2. I want to add the "apply" button on the "Parent Dialog"alongwith the OK and Cancel button. What code should i put in the Appply button ? Could someone please give me the code and tell me where to put it.

3. There are various Checkboxes and Edit boxes in my dialog on every page holding values like 236 , 12, 4567, 23.456, and so on . I want the user to be able to see the default values on invoking the dialog box and chnage it if they want.
What should i do for that ? Please let me know soon as it is very urgent.

iCe.
----------------------------------------------------------------------------------------------------------------
Six months into VC++ i am still a beginner.
---------------------------------------------------------------------------------------------------------------
0
Comment
Question by:iceb
[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
4 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 1200 total points
ID: 9847893
3. In OnInitDialog() assign the values to the edit fields with the member function SetWindowText() of the edit control. Assuming that you have a control variable for your edit field, it would look like this:
m_ctrlEditField1.SetWidnowText(_T("236"));

2. Add a button to the dialog and change the button label to "Apply", then add a handler for the button by e.g. double-clicking on the button in the resource editor. What the apply button does (and therefore the code you have to add) depends on what you want the button to do. Usually, the apply button takes the values the user has entered ans assigns them to data structures that you keep in other parts of your program. This usually also requires that you use these new values and "do something" with them - again, this depends on your program.
0
 
LVL 1

Author Comment

by:iceb
ID: 9847973
Hi there

I forgot to add that corresponding to a "checkbox" there are "two edit boxes. " If i select the checkbox or deselect the checkbox the coresponding values of the two Edit boxes should be selected or deselected.
|-----------------------------------------|
|Checkbox       Editbox     Editbox           |
|Checkbox            Editbox     Editbox           |
|-----------------------------------------|

since the Editbox allows the user to enter a string only. How do i covert the string to integer ?
since i will be putting in values like 12, 234, 45.67, 6789.09567 etc.
All this is enclosed in a Group Box. Do i have to worry about the Group Box ?
Please advise.

Also i am not able to TAB to the controls in the child Windows. I cannot reach the Checkboxes or the Editboxes by Tab.

Thanks in advance.

ICE
0
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 800 total points
ID: 9848614
The 'sub' dalogs need the ControlParent option set to true (properties in resource editor) - tabbing.
SetDlgItemText and related GetDlgItemText for retrieving /setting text.

double d = 1.23;
CString s;
s.Format("%6.2f", d);  //s = "1.23"

double x = atof(s);  //x = 1.23
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9890833
I forgot to add this:

1. The ampersand is interpreted as escape code for the keyboard accelerator. In your dialog, the character after the ampersand is very likely displayed underlined. You can turn this off by going to the Styles tab for e.g. static text and selecting the "no prefix" option.
0

Featured Post

Independent Software Vendors: 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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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