Classes for Dialog, how they works ?
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
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...
to retrieve text from textboxes you can use GetWindowText().. im not sure what you mean by Button values.. please explain...
Thanks for the Answer ...
Here a little Paste of Code
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
Here a little Paste of Code
// Suppose d'etre dans la classeclass 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
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...
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
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
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...
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement