Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LowRad

Classes for Dialog, how they works ?

This topic is 6689 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

Hi, I wonder if i can put the MessageHandler Precedure of my dialog box, in it''s class. And how i can retrieve value from TextBox or Button on the dialog. Thanks all LowRad

Share this post


Link to post
Share on other sites
Advertisement
Yes, you can use classes to encapsulate your code (message handlers, etc..)

to retrieve text from textboxes you can use GetWindowText().. im not sure what you mean by Button values.. please explain...

Share this post


Link to post
Share on other sites
Thanks for the Answer ...

Here a little Paste of Code

        
// Suppose d'etre dans la classe


class CConfig
{
public:
CConfig (void) {};
~CConfig (void) {};

BOOL Show (HWND hWnd, HINSTANCE hInstance);

private:
BOOL CALLBACK ConfigDlgProc (HWND hWnd, UINT mMsg,WPARAM wParam, LPARAM lParam);
};

[/source]

And in my .Cpp ...

[source]
BOOL CConfig::Show (HWND hWnd, HINSTANCE hInstance)
{
FARPROC lpitConfig = MakeProcInstance ((FARPROC)ConfigDlgProc, hInstance);

return DialogBox (hInstance, MAKEINTRESOURCE(IDD_CONFIG), hWnd, (DLGPROC)lpitConfig);
}

BOOL CALLBACK ConfigDlgProc (HWND hWnd, UINT mMsg, WPARAM wParam, LPARAM lParam)
{
switch (mMsg)
{
...
}
}




Sorry the source code is a little Ugly, but anyway...

The problem remain in Show for now, 'cause the first time i've wrote it, i had made the initialisation of the dialog in the constructor, Sound more simple...

But every time the compiler tell me : "I dont known if you want the adress of the Function or call it". Now that i've put the ConfigDlgProc outside the class it's working.

- The other thing, this dialog contain 1 group of RadioBox from where the user select the API to use. I wonder how can i integrated this in my code...


Thanks

LowRad



Edited by - LowRad on June 27, 2000 3:10:10 PM

Share this post


Link to post
Share on other sites
I''m not sure what you want to do with the RadioBox... What do you want to integrate into your code?!?! Sorry.. I''m not sure what you''re asking for...

Share this post


Link to post
Share on other sites
Thanks Gladiator for your help,

I have a Group named "Api Renderer" in which i got 3 RadioButton (Glide, Direct3D, OpenGl).

I known, that i must add a variable in my class like (m_ApiRenderer). I want it to have the value of the RadioButton selected (ie: m_ApiRenderer = 0, if Glide is selected, 1 if Direct3D is selected, ...)

But, i dont known how to get this value. I've seen that i can use WM_COMMAND, then ' switch(wParam) ' and if wParam == IDC_GLIDE, then set m_ApiRenderer to '0'. But i'm pretty sure there's a better way around that.


And how i initialise my Dialog if my DlgProc is in my Class??

thanks...

LowRad



Edited by - LowRad on June 27, 2000 3:25:01 PM

Share this post


Link to post
Share on other sites
I see what you mean now... Well, basically, what you just told me is how you do it in pure Win32... You need to switch once on the message, and a second time on the radio buttons.. just like you''d do for menus... witch on the WM_COMMAND and then switch on the menu IDs to see which menu item was clicked on..same thing goes for radio buttoins...

Share this post


Link to post
Share on other sites
Thanks,

Is ''cause i had MFC in head. In MFC you link a variable to the RadioButton then you use UpdateData(FALSE), and that way you''re linked variable took the right value.

Ok but now, as you told me, and as i think about it, i MUST put my MessageProcedure in my Class. But those error occur...

function in cause :
BOOL CConfig::Show (HWND hWnd, HINSTANCE hInstance)
{
FARPROC lpitConfig = MakeProcInstance ((FARPROC)::ConfigDlgProc , hInstance);

return DialogBox (hInstance, MAKEINTRESOURCE(IDD_CONFIG), hWnd, (DLGPROC)lpitConfig);
}

error:
Undefined symbol ''ConfigDlgProc''


But if i took off "::", its tell me ...
Member function must be called or its address taken

What did you think about that ?!

Thanks again ...
LowRad


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!