Solved

CTabCtrl : How to use the control boxes

Posted on 2003-11-30
4
483 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 300 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 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 200 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 35
mixString challenge 36 121
iSeries FTP Exit Program 8 136
Problem to open Excel file 15 133
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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