This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: Few minor issues
- From: Biju <bijumaillist at yahoo dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Thu, 29 May 2003 08:11:16 -0700 (PDT)
- Subject: Re: Few minor issues
- Reply-to: cygwin-xfree at cygwin dot com
--- Harold L Hunt II <huntharo@msu.edu> wrote:
> Biju wrote:
> > I dont know whether others noticed these.
> >
>
> Any ideas on how to get rid of the Maximize button on the dialog? I can
> do it by removing the WS_SYSMENU style... should we be using WS_SYSMENU
> or not? Not using WS_SYSMENU cause our icon to not be displayed on the
> upper-left hand corner, but I can't seem to find a flag that says "no
> maximize button".
Its long time since I worked in windows programming, So its like studying again.
I was trying these by linking XWin.rc against my sample application.
Here is what I found.
Adding WS_TABSTOP was giving me the maximize button.
So to make Cancel as default button I repositioned it.
you could use arrow keys, Tab key, "C" or "E" to move/select buttons.
here is the *.rc
(PS: I am using IDD_MAIN as Dialogid)
--------
IDD_MAIN DIALOG DISCARDABLE 32, 32, 180, 70
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cygwin/XFree86 - Exit?"
BEGIN
DEFPUSHBUTTON "&Cancel", IDCANCEL, 55, 48, 30, 14
PUSHBUTTON "&Exit", IDOK, 95, 48, 30, 14
CTEXT "Exiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8
CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 24, 166, 8
END
--------
Alternately you can keep OK as default button
(PS: I dont like this much, because OK is more damaging)
IDD_MAIN DIALOG DISCARDABLE 32, 32, 180, 70
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cygwin/XFree86 - Exit?"
BEGIN
DEFPUSHBUTTON "&Exit", IDOK, 55, 48, 30, 14
PUSHBUTTON "&Cancel", IDCANCEL, 95, 48, 30, 14
CTEXT "Exiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8
CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 24, 166, 8
END
In both case pressing "Esc" key will trigger "Cancel" button
because we are using IDCANCEL as its ID
You could use these styles for both EXIT_DIALOG and DEPTH_CHANGE
I use "SetWindowPos()" to bring it to topmost.
Here is my "WinProc" and "WinMain"
.......
.......
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
// This is where we set up the dialog box, and initialise any default values
SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);
.......
.......
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, DlgProc);
}
-------
cheers
Biju
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com