• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • Last Modified:

Dialog control co-ordinates

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
davev
Asked:
davev
  • 3
  • 3
1 Solution
 
qocarlosCommented:
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
 
MadYugoslavCommented:
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
 
davevAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
qocarlosCommented:
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
 
davevAuthor Commented:
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
 
davevAuthor Commented:
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
 
qocarlosCommented:
You're welcome!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now