Solved

Dialog control co-ordinates

Posted on 2001-06-12
7
434 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 59
canBalance challenge 34 65
mapAB Challlenge 35 89
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 92
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

13 Experts available now in Live!

Get 1:1 Help Now