Solved

Dialog control co-ordinates

Posted on 2001-06-12
7
436 Views
Last Modified: 2013-11-20
I'd like to have a CStatic in a dialog containing a bitmap so that I can click on predetermined areas of the bitmap (ie: hotspots) to perform some action. Is there a way to get the co-ordinates of the bitmap in relation to the dialog so that I can use the CPoint parameter of LButtonDown to determine if and where the point lies within the bitmap and perform some action if it does? I hope I've made myself clear in saying what I need but don't hesitate to ask for more info. TIA
0
Comment
Question by:davev
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

by:qocarlos
ID: 6183836
The best way to do what you want is to derive a new class from CStatic and draw the bitmap in the OnPaint function. Then you can handle OnLButtonDown message in the CStatic derived class. In this case the CPoint parameter is in relation to the CStatic control and not to the dialog itself.
Let me know if you need more information.

Carlos
0
 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6184901
Let say IDC_MY_BITMAP id Id of Your CStatic.
Let say DialogWindow ids Your Dialog.

CWnd* Win=DialogWindow->GetDlgItem(IDC_MY_BITMAP);
RECT Rect;
Win->GetWindowRect(&Rect);
DialogWindow->ScreenToClient(&Rect);

In Rect there are client coordinates of Your bitmap (relative to upper left corner of dialog).
0
 

Author Comment

by:davev
ID: 6188697
I've developed the derived class and made it a part of each of the 7 dialogs that are a part of my CPropertySheetEx-derived wizard app. I have also created the 7 bitmaps that are essentially a row of vertical buttons with each bitmap having one selected button designating where in the wizard you are. While Next and Back go through the dialogs sequentially, showing the proper bitmap at the side, the effect I'd like is being able to click on an area of the bitmap (the hotspots to this already work) such that I can navigate the wizard in any order I want. For example, at program startup, I start with step 1, but if I click on "button 4" of the bitmap, I'd like to go to the 4th page of the wizard and Next would continue with page 5. Then I might like to return to page 2, etc. It can't be a tabbed dialog where random navigation is possible unless I can also get the effect of Next and Back like a wizard to progess to successive tabs. So the problem I'm running into is I can process the LButtonDown of the page I'm on, but I can't get it to jump to the desired page. Any other suggestions or comments?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 3

Accepted Solution

by:
qocarlos earned 50 total points
ID: 6190023
That's a complete different question!
Anyway, what you need is a property sheet wizard. You basically just need to follow the same steps as you would follow to create a standard property sheet, but call SetWizardMode before you call DoModal. To enable the wizard buttons, call SetWizardButtons, using flags to customize their function and appearance. To enable the Finish button, call SetFinishText after the user has taken action on the last page of the wizard.

Have a look at http://www.codeproject.com/property/wizardpropertysheet.asp

Carlos
0
 

Author Comment

by:davev
ID: 6191736
I knew of of that. What I'm looking for is a way to have an area of each wizard page as a bitmap of buttons that would facilitate the navigation of the wizard in any order other than sequential. Double the point to anyone who can point me in the right direction before I figure it out myself.
0
 

Author Comment

by:davev
ID: 6191911
Duh! It pays to read the the class definitions! CPropertySheet::SetActivePage was all it took to get what I wanted. Thanks to Carlos for making an effort to help out.
0
 
LVL 3

Expert Comment

by:qocarlos
ID: 6192661
You're welcome!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
no14 challenge 14 66
tripleUp challenge 7 78
Annoying "thing" blocks my view 4 99
Sed question 2 84
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

774 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