Re: Few minor issues
--- Harold L Hunt II [EMAIL PROTECTED] 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
Re: Few minor issues
Biju wrote: I dont know whether others noticed these. 1) After we start XWin.exe the mouse pointer will automatically move to center of screen. This is OK for normal mode, -nodecoration and -fullscreen. But I think its not needed in -multiwindow and -rootless modes. I looked for the code that does this (it is general X code, not Cygwin/XFree86-specific code) the last time that someone brought this up (wasn't it you?). I could not find the code and I won't be looking for it again. Someone else can do the searching of the source code tree under xc/programs/Xserver to try to find it. It is most likely in xc/programs/Xserver/hw/os or xc/programs/Xserver/hw/dix, but I couldn't find it in either of those directories. 2) On -multiwindow mode if we press Alt-F4 on any of the X application screen it will popup Exit Dialog Box for XWin.exe. I don't know if there is a better way that this should work. Maybe you have a point. I might try to see if I can do anything. 3) On normal mode if click close (X) button on title bar, or close on sysmenu It close XWin.exe with out showing Exit Dialog Box Now you have a point. I was just calling GiveUp () in the WM_CLOSE message. I moved the call to GiveUp () to a WM_GIVEUP message. WM_CLOSE now opens the dialog box. The dialog box sends WM_GIVEUP if OK is pressed. This seems to work well on my system. Can we centralize the Exit Dialog Box using DS_CENTER flag for STYLE attribute? Thanks. I never saw any window styles for centering. There doesn't seem to be much documentation on the DS_* flags as a search in MSDN only turns up a handful of articles. I applied this to my local XWin.rc. To hide from taskbar we may be able to use WS_EX_TOOLWINDOW flag for EXSTYLE attribute. I am attaching an example for this. Hiding from the taskbar? It isn't shown on my taskbar. I am using Windows XP... what version are you using? WS_EX_TOOLWINDOW doesn't seem right. I tried it... it creats a window that looks like a tool pallette in Photoshop, not a dialog box. I did, however, add the extended style WS_EX_DLGMODALFRAME and the normal style WS_DLGFRAME. These didn't change anything for me, but they may help for you. I also noticed that an already existing exit dialog was not being brought to the foreground when the user performed another action that would display the dialog. The result was that the dialog box seemed to be lost and it seemed that you couldn't exit Cygwin/XFree86. I changed this to call SetForegroundWindow () for the dialog box when it already exists. This brings it to the top in response to such user-generated events. 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. Thanks for your help, Harold
Re: Few minor issues
Howdy Biju, Harold: At 12:03 AM 5/29/2003 -0400, you wrote: Biju wrote: I dont know whether others noticed these. 1) After we start XWin.exe the mouse pointer will automatically move to center of screen. This is OK for normal mode, -nodecoration and -fullscreen. But I think its not needed in -multiwindow and -rootless modes. I looked for the code that does this (it is general X code, not Cygwin/XFree86-specific code) the last time that someone brought this up (wasn't it you?). I could not find the code and I won't be looking for it again. Someone else can do the searching of the source code tree under xc/programs/Xserver to try to find it. It is most likely in xc/programs/Xserver/hw/os or xc/programs/Xserver/hw/dix, but I couldn't find it in either of those directories. Well, you could always throw out the 1st cursor positioning call since it is guaranteed to be from the X server itself and not an application. That way you do not have to modify any of the standard X server code, just the xwin/ directory files... ...To hide from taskbar we may be able to use WS_EX_TOOLWINDOW flag for EXSTYLE attribute. I am attaching an example for this. Hiding from the taskbar? It isn't shown on my taskbar. I am using Windows XP... what version are you using? It doesn't show up under W2K either. I also noticed that an already existing exit dialog was not being brought to the foreground when the user performed another action that would display the dialog. The result was that the dialog box seemed to be lost and it seemed that you couldn't exit Cygwin/XFree86. I changed this to call SetForegroundWindow () for the dialog box when it already exists. This brings it to the top in response to such user-generated events. 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. This is just stylistic on my part, but why not just use a MessageBox? Other apps use one with MB_APPLMODAL when you're about to exit from them... Here's what you need to do to get your exit dialog without the max/min buttons /* Create dialog box */ g_hDlgExit = CreateDialogParam (g_hInstance, ... + SetWindowLong( g_hDlgExit, GWL_STYLE, GetWindowLong(g_hDlgExit, GWL_STYLE)~(WS_MAXIMIZEBOX|WS_MINIMIZEBOX) ); + SetWindowLong( g_hDlgExit, GWL_EXSTYLE, GetWindowLong(g_hDlgExit, GWL_EXSTYLE)~WS_EX_APPWINDOW ); + SetWindowPos( g_hDlgExit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOZORDER|SWP_NOSIZE ); /* Show the dialog box */ ShowWindow (g_hDlgExit, SW_SHOW); -Earle F. Philhower, III [EMAIL PROTECTED] cdrlabel - ZipLabel - FlpLabel http://www.cdrlabel.com