Jump to content
  • Advertisement
Sign in to follow this  
giuseppeCT

Mfc data exchange through classes

This topic is 5401 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hola, i've a lit prob, i need to notify events through classes, i'm using Mfc as sdi doc/view, the problem is that i've a toolbar with several buttons and i need to notify to my tab dialogs that a button was clicked and so to update the dialog specific resource (edit or listbox variables and so on...) which's the best way to update class specific variables from one to the other and viceversa? hope the problem is enough clear, thanx in advance!!! hope for an help too ;) !!!

Share this post


Link to post
Share on other sites
Advertisement
I assume you mean a tab based dialogbar that is connected to your main frame?

When receiving the event for the toolbar for example in your view object, you can call a public member function of your tab dialog to update it's content. Another option is to send a notify message to the dialog. From the dialog you can get the current document object via CMainFrame::GetCurrentDocument and retreive the data via your own get functions.

Share this post


Link to post
Share on other sites
Yes, i've a splittered window with a main toolbar, in the left part ther's the view and in the right one the main dialog frame with a tab connected to other dialogs, what i need is to understand how to exchange datas through those all "things", i've added a function to a toolbar button called from an ON_BN_CLICKED message, that function initialize some datas in the Viewer class and i want to pass these datas to my dialogs updating their objects and if needed the opposite. i'm not using the document class derived from CDocView, it is clear.......... !!!! may you post some example? thanx a lot dude !!! anyway i'm trying to call a public function of the dialog object but compiler doesn't recognize it, i'm sorry i'm very new with mfc and maybe i need to read more about !!!
oh, i'm trying to call a dialog public funtion from the view object, and this is the result:

"illegal call of non-static member function"

i've tried to make it static and all works fine if i don't try to pass a variable to it, obviously it should be static but if i put it static i got an unresolved link error.......uhm....i need to study a little more :) !!! any explanation are very very appreciated!!! greets!!!

[Edited by - giuseppeCT on October 4, 2004 1:53:42 PM]

Share this post


Link to post
Share on other sites
so, i've found a solution to my problem, first i've define the update public function of my dialogs as static, then same thing with the variable that da function will update, in the viewer class i've instatiated that variable and voilà i can call my function freely and set the var too, the only thing perplexing me is that i can't use da class wizzy without get an error message :/ !!! greets !!!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!