Solved

Resources vs Classes

Posted on 2000-04-14
8
190 Views
Last Modified: 2013-11-20
When a new secondary resource is added, like Menu, Toolbar etc., ClassWizard asks which class to belong this resource to. Whatever I answer, I can see the IDs of that resource in every classes in the ClassWizard. So, what does it matter which class "owns" the resource? And what happens if I add to different functions to respond to the same ID in two different classes?
0
Comment
Question by:Lescha
  • 4
  • 3
8 Comments
 
LVL 3

Expert Comment

by:ghimireniraj
Comment Utility
Mainframe class

You can also write handlers to them in the view class or classes.

If multiple views are present and you write handler to one view this is unavailable for all the other views.

but if it is in mainframe it is always available whatever view is active through the mainframe class
0
 
LVL 1

Author Comment

by:Lescha
Comment Utility
Sorry... could you clarify yourself a bit? I didn't quite get the answer. ;-(

And I didn't talk just about SDI/MDI, I was talking in general!
0
 

Expert Comment

by:ch52jb
Comment Utility
The reason that a resource is 'owned by a class' is so that class becomes the default for member variables and events that are assigned.  However you can assign events and the like to any class.  If you assign different events to the same id, then the first one to get the message handles it.  For example, all dialogs use a button click event frmo IDOK to ok the dialog.  If Dialog1 opens Dialog2 modally, clicking on the OK button sends a button click message with the ID IDOK to the topmost window, so dialog2 handles it, even though dialog1 also has a handler for the same event.
0
 
LVL 1

Author Comment

by:Lescha
Comment Utility
Yes, but what happens if I have to unmodal dialogs... oh, I get it. You mean, the one that has the function AND the focus handles the message?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 1

Author Comment

by:Lescha
Comment Utility
..I meant, "TWO unmodal dialogs", of course! ;)
0
 

Expert Comment

by:ch52jb
Comment Utility
Yes, the way windows works is when it posts a message, the window with the highest z order (i.e. the one with focus) gets the message first, then it gets passed down the z order.  If the topmost window has the correct handler then it will process the message.  If not, it posts it on to the next window.  In the case of events like button clicks, the window in focus will get the event, whether it is modal or unmodal.
0
 
LVL 1

Author Comment

by:Lescha
Comment Utility
uh-huh... thanks, "ch52jb". Please lock the answer.
0
 

Accepted Solution

by:
ch52jb earned 20 total points
Comment Utility
Tis locked.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 discusses moving either the default database or any database to a new volume.

762 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

6 Experts available now in Live!

Get 1:1 Help Now