Solved

Dialog control co-ordinates

Posted on 2001-06-12
7
439 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
[X]
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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 59
Get filename and folder into excel 7 87
Change owner from userA to server Local Administrators 7 73
withoutTen challenge 14 140
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 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