From: <mie...@us...> - 2007-10-07 20:44:16
|
Revision: 881 http://oorexx.svn.sourceforge.net/oorexx/?rev=881&view=rev Author: miesfeld Date: 2007-10-07 13:44:19 -0700 (Sun, 07 Oct 2007) Log Message: ----------- Implement [ 1809129 ] ooDialog - retrieve control ID from window handle, includes refactoring the WinAPI32Func() C function. [ 1779444 ] Enhance ooDialog for function key or hotkeys, missed a line in the merge of my working code into the patch. Modified Paths: -------------- interpreter-3.x/trunk/platform/windows/oodialog/oovdata.c interpreter-3.x/trunk/platform/windows/oodialog/oovutil.c interpreter-3.x/trunk/platform/windows/oodialog/plbdlg.cls Modified: interpreter-3.x/trunk/platform/windows/oodialog/oovdata.c =================================================================== --- interpreter-3.x/trunk/platform/windows/oodialog/oovdata.c 2007-10-06 22:58:39 UTC (rev 880) +++ interpreter-3.x/trunk/platform/windows/oodialog/oovdata.c 2007-10-07 20:44:19 UTC (rev 881) @@ -42,12 +42,12 @@ #include <rexx.h> #include <stdio.h> #include <dlgs.h> +#include <commctrl.h> #ifdef __CTL3D #include <ctl3d.h> #endif #define EXTERNALFUNCS #include "oovutil.h" -#include <commctrl.h> /* I do most of the radio button handling myself now so I know it works */ Modified: interpreter-3.x/trunk/platform/windows/oodialog/oovutil.c =================================================================== --- interpreter-3.x/trunk/platform/windows/oodialog/oovutil.c 2007-10-06 22:58:39 UTC (rev 880) +++ interpreter-3.x/trunk/platform/windows/oodialog/oovutil.c 2007-10-07 20:44:19 UTC (rev 881) @@ -827,8 +827,10 @@ * * The parameters sent from ooRexx as an array of RXString: * - * argv[0] Selects specific function. + * argv[0] Selects general category. * + * argv[1] Picks specific function. + * * argv[2] ... argv[n] Varies depending on the function. * * Return to ooRexx, in general: @@ -842,36 +844,56 @@ PUCHAR qname, PRXSTRING retstr ) { - /* There has to be at least 1 arg. */ - CHECKARGL(1); + /* There has to be at least 2 args. */ + CHECKARGL(2); - if ( !strcmp(argv[0].strptr, "WNDSTATE") ) /* Get window state */ + if ( argv[0].strptr[0] == 'G' ) /* Get something */ { - HWND hWnd; + if ( !strcmp(argv[1].strptr, "WNDSTATE") ) /* get Window state */ + { + HWND hWnd; - CHECKARGL(3); + CHECKARGL(4); - hWnd = (HWND)atol(argv[2].strptr); - if ( hWnd == 0 || ! IsWindow(hWnd) ) RETERR + hWnd = (HWND)atol(argv[3].strptr); + if ( hWnd == 0 || ! IsWindow(hWnd) ) RETERR - if ( argv[1].strptr[0] == 'E' ) /* Enabled */ - { - RETVAL((BOOL)IsWindowEnabled(hWnd)); + if ( argv[2].strptr[0] == 'E' ) /* Enabled */ + { + RETVAL((BOOL)IsWindowEnabled(hWnd)); + } + else if ( argv[2].strptr[0] == 'V' ) /* Visible */ + { + RETVAL((BOOL)IsWindowVisible(hWnd)); + } + else if ( argv[2].strptr[0] == 'Z' ) /* Zoomed is Maximized */ + { + RETVAL((BOOL)IsZoomed(hWnd)); + } + else if ( argv[2].strptr[0] == 'I' ) /* Iconic is Minimized */ + { + RETVAL((BOOL)IsIconic(hWnd)); + } } - else if ( argv[1].strptr[0] == 'V' ) /* Visible */ + else if ( !strcmp(argv[1].strptr, "ID") ) /* get dialog control ID */ { - RETVAL((BOOL)IsWindowVisible(hWnd)); + HWND hWnd; + INT id; + + CHECKARGL(3); + + hWnd = (HWND)atol(argv[2].strptr); + if ( hWnd == 0 || ! IsWindow(hWnd) ) RETVAL(-1) + + SetLastError(0); + id = GetDlgCtrlID(hWnd); + if ( ! id ) + id = -(INT)GetLastError(); + + RETVAL(id); } - else if ( argv[1].strptr[0] == 'Z' ) /* Zoomed is Maximized */ - { - RETVAL((BOOL)IsZoomed(hWnd)); - } - else if ( argv[1].strptr[0] == 'I' ) /* Iconic is Minimized */ - { - RETVAL((BOOL)IsIconic(hWnd)); - } } - else if ( !strcmp(argv[0].strptr, "KBHOOK") ) /* Work with Keyboard Hook */ + else if ( argv[0].strptr[0] == 'K' ) /* work with Keyboard hook */ { DIALOGADMIN *dlgAdm = NULL; HWND hDlg; Modified: interpreter-3.x/trunk/platform/windows/oodialog/plbdlg.cls =================================================================== --- interpreter-3.x/trunk/platform/windows/oodialog/plbdlg.cls 2007-10-06 22:58:39 UTC (rev 880) +++ interpreter-3.x/trunk/platform/windows/oodialog/plbdlg.cls 2007-10-07 20:44:19 UTC (rev 881) @@ -139,10 +139,10 @@ return WndShow_Pos("S",self~Hwnd, "NORMAL") ::method IsVisible unguarded - return WinAPI32Func("WNDSTATE", "V", self~hwnd) + return WinAPI32Func("G", "WNDSTATE", "V", self~hwnd) ::method IsEnabled unguarded - return WinAPI32Func("WNDSTATE", "E", self~hwnd) + return WinAPI32Func("G", "WNDSTATE", "E", self~hwnd) ::method Resize unguarded use arg width, hight, showOptions @@ -471,6 +471,9 @@ if Arg(2,'o') = 1 then hDlg = self~DlgHandle return HandleDlg("ITEM",id, hDlg) +::method GetControlID unguarded + use strict arg hWnd + return WinAPI32Func("G", "ID", hWnd) /* This method shows the dialog */ @@ -494,10 +497,10 @@ return WndShow_Pos("S",self~DlgHandle, "MAX") ::method IsMaximized unguarded - return WinAPI32Func("WNDSTATE", "Z", self~DlgHandle) + return WinAPI32Func("G", "WNDSTATE", "Z", self~DlgHandle) ::method IsMinimized unguarded - return WinAPI32Func("WNDSTATE", "I", self~DlgHandle) + return WinAPI32Func("G", "WNDSTATE", "I", self~DlgHandle) ::method Restore unguarded return WndShow_Pos("S",self~DlgHandle, "RESTORE") @@ -573,25 +576,25 @@ ::method ConnectFKeyPress unguarded use strict arg msgToRaise if \ msgToRaise~isA(.String) then return -1 - return WinAPI32Func("KBHOOK", 'C', self~adm, self~dlgHandle, msgToRaise~translate, "FKEYS", "NONE") + return WinAPI32Func("K", 'C', self~adm, self~dlgHandle, msgToRaise~translate, "FKEYS", "NONE") ::method ConnectKeyPress unguarded use strict arg msgToRaise, keys, filter = "" if \ msgToRaise~isA(.String) | \ keys~isA(.String) | \ filter~isA(.String) then return -1 - if filter == "" then return WinAPI32Func("KBHOOK", 'C', self~adm, self~dlgHandle, msgToRaise~translate, keys~space(0)) - return WinAPI32Func("KBHOOK", 'C', self~adm, self~dlgHandle, msgToRaise~translate, keys~space(0), filter~translate) + if filter == "" then return WinAPI32Func("K", 'C', self~adm, self~dlgHandle, msgToRaise~translate, keys~space(0)) + return WinAPI32Func("K", 'C', self~adm, self~dlgHandle, msgToRaise~translate, keys~space(0), filter~translate) ::method DisconnectKeyPress unguarded use arg msgToRaise - if arg(1, 'O') then return WinAPI32Func("KBHOOK", 'R', self~adm) + if arg(1, 'O') then return WinAPI32Func("K", 'R', self~adm) if \ msgToRaise~isA(.String) then return -1 - return WinAPI32Func("KBHOOK", 'R', self~adm, self~dlgHandle, msgToRaise~translate) + return WinAPI32Func("K", 'R', self~adm, self~dlgHandle, msgToRaise~translate) ::method HasKeyPressConnection unguarded use arg msgToRaise - if arg(1, 'O') then return WinAPI32Func("KBHOOK", 'Q', self~adm) + if arg(1, 'O') then return WinAPI32Func("K", 'Q', self~adm) if \ msgToRaise~isA(.String) then return -1 - return WinAPI32Func("KBHOOK", 'Q', self~adm, msgToRaise~translate) + return WinAPI32Func("K", 'Q', self~adm, msgToRaise~translate) /* The following methods are to connect an item of the data stem with */ /* a data field of the dialog. The data stem will start with number 1 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |