Solved

Dialog control co-ordinates

Posted on 2001-06-12
7
435 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rewrite URL With Encoded Characters 6 75
Separate into files by filename 12 75
scoreUp challenge 14 56
changeXy challenge 13 67
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

19 Experts available now in Live!

Get 1:1 Help Now