[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CTabCtrl : How to use the control boxes

Posted on 2003-11-30
4
Medium Priority
?
508 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

834 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