Solved

CTabCtrl : How to use the control boxes

Posted on 2003-11-30
4
478 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now