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

CTabCtrl : How to use the control boxes

Posted on 2003-11-30
4
485 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Title # Comments Views Activity
Adapt this command to show who installed 29 111
centeredAverage challenge 8 178
sumHeights2  challenge 7 114
Problem to App source 6 69
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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.

766 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