View previous topic :: View next topic |
Author |
Message |
Aikos Cheater
Reputation: 0
Joined: 26 Nov 2007 Posts: 47
|
Posted: Fri Nov 30, 2007 9:35 pm Post subject: Dialog vs Standard Window? |
|
|
From the winprog win32 tutorial, I read that the system does additional processing for dialogs, and if you are using standard windows, you have to program those features manually. Now I am wondering what's the point of using standard windows if dialogs can be more easily created via resources?
Actually I was programming a simple application with C++ on the win32, and got stuck at a number of things such as tabstops, default push buttons...
|
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Nov 30, 2007 9:50 pm Post subject: |
|
|
Dialogs take up more resources and have to be loaded into memory alot more strenuously than windows.
Read Petzold
_________________
|
|
Back to top |
|
 |
Aikos Cheater
Reputation: 0
Joined: 26 Nov 2007 Posts: 47
|
Posted: Fri Nov 30, 2007 10:20 pm Post subject: |
|
|
Understood. But are the overheads of using dialogs worth when the coding can be simplified to a certain extent?
|
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Nov 30, 2007 10:32 pm Post subject: |
|
|
win32 WNDCLASSX and CreateWindowEx works fine for me. I don't find the code sloppy at all. When it comes down to it, i'd go the dialogless way
_________________
|
|
Back to top |
|
 |
Aikos Cheater
Reputation: 0
Joined: 26 Nov 2007 Posts: 47
|
Posted: Sat Dec 01, 2007 4:49 am Post subject: |
|
|
I still have problems implementing tab stops in a standard window. Can anyone enlighten me to an example?
|
|
Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Dec 01, 2007 5:44 am Post subject: |
|
|
Aikos wrote: | Understood. But are the overheads of using dialogs worth when the coding can be simplified to a certain extent? |
Not at all. Use main windows. Only use dialogs on small windows that don't have lots of user interaction or controls, like about boxes (but with Windows Vista, the TaskDialog function deprecates many uses for Dialogs).
Aikos wrote: | I still have problems implementing tab stops in a standard window. Can anyone enlighten me to an example? |
Create a list of controls, then use the SetFocus function to set the focus on another control when tab is pressed.
_________________
|
|
Back to top |
|
 |
Aikos Cheater
Reputation: 0
Joined: 26 Nov 2007 Posts: 47
|
Posted: Sat Dec 01, 2007 7:19 am Post subject: |
|
|
appalsap wrote: | Create a list of controls, then use the SetFocus function to set the focus on another control when tab is pressed. |
I get the concept of this method. But when the focus is on another control, how do I capture the keypress? Since WM_KEYDOWN only works for the main window. Do I have to use GetAsyncKeyState on another thread to watch it? (seems like too complicated and not the simplest answer according to my intuition)
|
|
Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Dec 01, 2007 7:20 am Post subject: |
|
|
Aikos wrote: | I get the concept of this method. But when the focus is on another control, how do I capture the keypress? Since WM_KEYDOWN only works for the main window. Do I have to use GetAsyncKeyState on another thread to watch it? (seems like too complicated and not the simplest answer according to my intuition) |
Subclass the window. Each button, edit box etc is a window of its own, with its own WndProc (which you can check WM_KEYDOWN for). Another reason why you should use standard windows, this becomes clear and the abstractions don't confuse you.
_________________
|
|
Back to top |
|
 |
Aikos Cheater
Reputation: 0
Joined: 26 Nov 2007 Posts: 47
|
Posted: Sat Dec 01, 2007 7:47 pm Post subject: |
|
|
Thanks appalsap. I had a thought that it would possibly window subclassing that does the trick.
|
|
Back to top |
|
 |
|