Hi,
I have one problem with button attribute NO-FOCUS and use BS_MULTILINE (user32.dll).
Thank you for one solution.
Exemple:
&Scoped-define WINDOW-NAME wWin
/*------------------------------------------------------------------------
File:
Description: from cntnrwin.w - ADM SmartWindow Template
Input Parameters:
<none>
Output Parameters:
<none>
History: New V9 Version - January 15, 1998
------------------------------------------------------------------------*/
/* This .W file was created with the Progress AB. */
/*----------------------------------------------------------------------*/
/* Create an unnamed pool to store all the widgets created
by this procedure. This is a good default which assures
that this procedure's triggers and internal procedures
will execute in this procedure's storage, and that proper
cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
/* *************************** Definitions ************************** */
/* Parameters Definitions --- */
/* Local Variable Definitions --- */
/* ******************** Preprocessor Definitions ******************** */
&Scoped-define PROCEDURE-TYPE SmartWindow
&Scoped-define DB-AWARE no
&Scoped-define ADM-CONTAINER WINDOW
&Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source
/* Name of first Frame and/or Browse and/or first Query */
&Scoped-define FRAME-NAME fMain
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS BUTTON-1 BUTTON-2
/* Custom List Definitions */
/* List-1,List-2,List-3,List-4,List-5,List-6 */
/* *********************** Control Definitions ********************** */
/* Define the widget handle for the window */
DEFINE VAR wWin AS WIDGET-HANDLE NO-UNDO.
/* Definitions of the field level widgets */
DEFINE BUTTON BUTTON-1 NO-FOCUS
LABEL "No-Focus No-Focus"
SIZE 15 BY 3.1.
DEFINE BUTTON BUTTON-2
LABEL "Focus Focus Focus"
SIZE 15 BY 3.1.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME fMain
BUTTON-1 AT ROW 2.91 COL 30
BUTTON-2 AT ROW 2.67 COL 72
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 118 BY 7.76.
/* *********************** Procedure Settings ************************ */
/* Settings for THIS-PROCEDURE
Type: SmartWindow
Allow: Basic,Browse,DB-Fields,Query,Smart,Window
Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source
*/
/* ************************* Create Window ************************** */
IF SESSION
ISPLAY-TYPE = "GUI":U THEN
CREATE WINDOW wWin ASSIGN
HIDDEN = YES
TITLE = "<insert SmartWindow title>"
HEIGHT = 7.76
WIDTH = 118
MAX-HEIGHT = 28.81
MAX-WIDTH = 146.2
VIRTUAL-HEIGHT = 28.81
VIRTUAL-WIDTH = 146.2
RESIZE = no
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.
ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
/* END WINDOW DEFINITION */
/* ************************* Included-Libraries *********************** */
{src/adm2/containr.i}
/* *********** Runtime Attributes and AppBuilder Settings *********** */
/* SETTINGS FOR WINDOW wWin
VISIBLE,,RUN-PERSISTENT */
/* SETTINGS FOR FRAME fMain
*/
ASSIGN
BUTTON-2:AUTO-RESIZE IN FRAME fMain = TRUE.
IF SESSION
ISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin)
THEN wWin:HIDDEN = yes.
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME wWin
ON END-ERROR OF wWin /* <insert SmartWindow title> */
OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc" key.
In a persistently run window, just ignore this. If we did not, the
application would exit. */
IF THIS-PROCEDURE
ERSISTENT THEN RETURN NO-APPLY.
END.
ON WINDOW-CLOSE OF wWin /* <insert SmartWindow title> */
DO:
/* This ADM code must be left here in order for the SmartWindow
and its descendents to terminate properly on exit. */
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN NO-APPLY.
END.
&UNDEFINE SELF-NAME
/* *************************** Main Block *************************** */
/* Include custom Main Block code for SmartWindows. */
{src/adm2/windowmn.i}
PROCEDURE SendMessageA EXTERNAL 'USER32.DLL':U:
DEFINE INPUT PARAMETER hWnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER Msg AS LONG NO-UNDO.
DEFINE INPUT PARAMETER wParam AS LONG NO-UNDO.
DEFINE INPUT PARAMETER lParam AS LONG NO-UNDO.
END.
PROCEDURE GetWindowLongA EXTERNAL 'USER32.DLL':U:
DEFINE INPUT PARAMETER hWnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER nIndex AS LONG NO-UNDO.
DEFINE RETURN PARAMETER flgs AS LONG NO-UNDO.
END.
PROCEDURE SetWindowLongA EXTERNAL 'USER32.DLL':U:
DEFINE INPUT PARAMETER hWnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER nIndex AS LONG NO-UNDO.
DEFINE INPUT PARAMETER dwNewLong AS LONG NO-UNDO.
END.
RUN ButtonMultiline (BUTTON-1:HWND).
RUN ButtonMultiline (BUTTON-2:HWND).
/* ********************** Internal Procedures *********************** */
PROCEDURE adm-create-objects :
/*------------------------------------------------------------------------------
Purpose: Create handles for all SmartObjects used in this procedure.
After SmartObjects are initialized, then SmartLinks are added.
Parameters: <none>
------------------------------------------------------------------------------*/
END PROCEDURE.
PROCEDURE ButtonMultiline :
/*------------------------------------------------------------------------------
Purpose: Fer un boto amb text multi-linia
Parameters: HWND del boto
Notes:
------------------------------------------------------------------------------*/
&GLOBAL-DEFINE GWL_STYLE -16
&GLOBAL-DEFINE BM_SETSTYLE 244 /*0x00F4*/
&GLOBAL-DEFINE WS_CHILD 1073741824 /*0x40000000L*/
&GLOBAL-DEFINE WS_VISIBLE 268435456 /*0x10000000L*/
&GLOBAL-DEFINE WS_CLIPSIBLINGS 67108864 /*0x04000000L*/
&GLOBAL-DEFINE BS_PUSHBUTTON 0 /*0x00000000L*/
&GLOBAL-DEFINE BS_DEFPUSHBUTTON 1 /*0x00000001L*/
&GLOBAL-DEFINE BS_CHECKBOX 2 /*0x00000002L*/
&GLOBAL-DEFINE BS_AUTOCHECKBOX 3 /*0x00000003L*/
&GLOBAL-DEFINE BS_RADIOBUTTON 4 /*0x00000004L*/
&GLOBAL-DEFINE BS_3STATE 5 /*0x00000005L*/
&GLOBAL-DEFINE BS_AUTO3STATE 6 /*0x00000006L*/
&GLOBAL-DEFINE BS_GROUPBOX 7 /*0x00000007L*/
&GLOBAL-DEFINE BS_USERBUTTON 8 /*0x00000008L*/
&GLOBAL-DEFINE BS_AUTORADIOBUTTON 9 /*0x00000009L*/
&GLOBAL-DEFINE BS_OWNERDRAW 11 /*0x0000000BL*/
&GLOBAL-DEFINE BS_LEFTTEXT 32 /*0x00000020L*/
&GLOBAL-DEFINE BS_TEXT 0 /*0x00000000L*/
&GLOBAL-DEFINE BS_ICON 64 /*0x00000040L*/
&GLOBAL-DEFINE BS_BITMAP 128 /*0x00000080L*/
&GLOBAL-DEFINE BS_LEFT 256 /*0x00000100L*/
&GLOBAL-DEFINE BS_RIGHT 512 /*0x00000200L*/
&GLOBAL-DEFINE BS_CENTER 768 /*0x00000300L*/
&GLOBAL-DEFINE BS_TOP 1024 /*0x00000400L*/
&GLOBAL-DEFINE BS_BOTTOM 2048 /*0x00000800L*/
&GLOBAL-DEFINE BS_VCENTER 3072 /*0x00000C00L*/
&GLOBAL-DEFINE BS_PUSHLIKE 4096 /*0x00001000L*/
&GLOBAL-DEFINE BS_MULTILINE 8192 /*0x00002000L*/
&GLOBAL-DEFINE BS_NOTIFY 16384 /*0x00004000L*/
&GLOBAL-DEFINE BS_FLAT 32768 /*0x00008000L*/
&GLOBAL-DEFINE BN_CLICKED 0
&GLOBAL-DEFINE BN_DBLCLK 5
&GLOBAL-DEFINE BN_SETFOCUS 6
&GLOBAL-DEFINE BN_KILLFOCUS 7
DEFINE INPUT PARAMETER piHwnd AS INTEGER NO-UNDO.
DEFINE VARIABLE iTipus AS INTEGER NO-UNDO.
RUN GetWindowLongA (piHwnd,{&GWL_STYLE},OUTPUT iTipus) .
ASSIGN iTipus = iTipus + {&BS_MULTILINE}.
RUN SetWindowLongA (piHwnd,{&GWL_STYLE},iTipus).
RUN SendMessageA (piHwnd,{&BM_SETSTYLE},iTipus,1).
END PROCEDURE.
PROCEDURE disable_UI :
/*------------------------------------------------------------------------------
Purpose: DISABLE the User Interface
Parameters: <none>
Notes: Here we clean-up the user-interface by deleting
dynamic widgets we have created and/or hide
frames. This procedure is usually called when
we are ready to "clean-up" after running.
------------------------------------------------------------------------------*/
/* Delete the WINDOW we created */
IF SESSION
ISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin)
THEN DELETE WIDGET wWin.
IF THIS-PROCEDURE
ERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
END PROCEDURE.
PROCEDURE enable_UI :
/*------------------------------------------------------------------------------
Purpose: ENABLE the User Interface
Parameters: <none>
Notes: Here we display/view/enable the widgets in the
user-interface. In addition, OPEN all queries
associated with each FRAME and BROWSE.
These statements here are based on the "Other
Settings" section of the widget Property Sheets.
------------------------------------------------------------------------------*/
ENABLE BUTTON-1 BUTTON-2
WITH FRAME fMain IN WINDOW wWin.
{&OPEN-BROWSERS-IN-QUERY-fMain}
VIEW wWin.
END PROCEDURE.
PROCEDURE exitObject :
/*------------------------------------------------------------------------------
Purpose: Window-specific override of this procedure which destroys
its contents and itself.
Notes:
------------------------------------------------------------------------------*/
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN.
END PROCEDURE.
I have one problem with button attribute NO-FOCUS and use BS_MULTILINE (user32.dll).
Thank you for one solution.
Exemple:
&Scoped-define WINDOW-NAME wWin
/*------------------------------------------------------------------------
File:
Description: from cntnrwin.w - ADM SmartWindow Template
Input Parameters:
<none>
Output Parameters:
<none>
History: New V9 Version - January 15, 1998
------------------------------------------------------------------------*/
/* This .W file was created with the Progress AB. */
/*----------------------------------------------------------------------*/
/* Create an unnamed pool to store all the widgets created
by this procedure. This is a good default which assures
that this procedure's triggers and internal procedures
will execute in this procedure's storage, and that proper
cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
/* *************************** Definitions ************************** */
/* Parameters Definitions --- */
/* Local Variable Definitions --- */
/* ******************** Preprocessor Definitions ******************** */
&Scoped-define PROCEDURE-TYPE SmartWindow
&Scoped-define DB-AWARE no
&Scoped-define ADM-CONTAINER WINDOW
&Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source
/* Name of first Frame and/or Browse and/or first Query */
&Scoped-define FRAME-NAME fMain
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS BUTTON-1 BUTTON-2
/* Custom List Definitions */
/* List-1,List-2,List-3,List-4,List-5,List-6 */
/* *********************** Control Definitions ********************** */
/* Define the widget handle for the window */
DEFINE VAR wWin AS WIDGET-HANDLE NO-UNDO.
/* Definitions of the field level widgets */
DEFINE BUTTON BUTTON-1 NO-FOCUS
LABEL "No-Focus No-Focus"
SIZE 15 BY 3.1.
DEFINE BUTTON BUTTON-2
LABEL "Focus Focus Focus"
SIZE 15 BY 3.1.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME fMain
BUTTON-1 AT ROW 2.91 COL 30
BUTTON-2 AT ROW 2.67 COL 72
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 118 BY 7.76.
/* *********************** Procedure Settings ************************ */
/* Settings for THIS-PROCEDURE
Type: SmartWindow
Allow: Basic,Browse,DB-Fields,Query,Smart,Window
Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source
*/
/* ************************* Create Window ************************** */
IF SESSION

CREATE WINDOW wWin ASSIGN
HIDDEN = YES
TITLE = "<insert SmartWindow title>"
HEIGHT = 7.76
WIDTH = 118
MAX-HEIGHT = 28.81
MAX-WIDTH = 146.2
VIRTUAL-HEIGHT = 28.81
VIRTUAL-WIDTH = 146.2
RESIZE = no
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.
ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
/* END WINDOW DEFINITION */
/* ************************* Included-Libraries *********************** */
{src/adm2/containr.i}
/* *********** Runtime Attributes and AppBuilder Settings *********** */
/* SETTINGS FOR WINDOW wWin
VISIBLE,,RUN-PERSISTENT */
/* SETTINGS FOR FRAME fMain
*/
ASSIGN
BUTTON-2:AUTO-RESIZE IN FRAME fMain = TRUE.
IF SESSION

THEN wWin:HIDDEN = yes.
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME wWin
ON END-ERROR OF wWin /* <insert SmartWindow title> */
OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc" key.
In a persistently run window, just ignore this. If we did not, the
application would exit. */
IF THIS-PROCEDURE

END.
ON WINDOW-CLOSE OF wWin /* <insert SmartWindow title> */
DO:
/* This ADM code must be left here in order for the SmartWindow
and its descendents to terminate properly on exit. */
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN NO-APPLY.
END.
&UNDEFINE SELF-NAME
/* *************************** Main Block *************************** */
/* Include custom Main Block code for SmartWindows. */
{src/adm2/windowmn.i}
PROCEDURE SendMessageA EXTERNAL 'USER32.DLL':U:
DEFINE INPUT PARAMETER hWnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER Msg AS LONG NO-UNDO.
DEFINE INPUT PARAMETER wParam AS LONG NO-UNDO.
DEFINE INPUT PARAMETER lParam AS LONG NO-UNDO.
END.
PROCEDURE GetWindowLongA EXTERNAL 'USER32.DLL':U:
DEFINE INPUT PARAMETER hWnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER nIndex AS LONG NO-UNDO.
DEFINE RETURN PARAMETER flgs AS LONG NO-UNDO.
END.
PROCEDURE SetWindowLongA EXTERNAL 'USER32.DLL':U:
DEFINE INPUT PARAMETER hWnd AS LONG NO-UNDO.
DEFINE INPUT PARAMETER nIndex AS LONG NO-UNDO.
DEFINE INPUT PARAMETER dwNewLong AS LONG NO-UNDO.
END.
RUN ButtonMultiline (BUTTON-1:HWND).
RUN ButtonMultiline (BUTTON-2:HWND).
/* ********************** Internal Procedures *********************** */
PROCEDURE adm-create-objects :
/*------------------------------------------------------------------------------
Purpose: Create handles for all SmartObjects used in this procedure.
After SmartObjects are initialized, then SmartLinks are added.
Parameters: <none>
------------------------------------------------------------------------------*/
END PROCEDURE.
PROCEDURE ButtonMultiline :
/*------------------------------------------------------------------------------
Purpose: Fer un boto amb text multi-linia
Parameters: HWND del boto
Notes:
------------------------------------------------------------------------------*/
&GLOBAL-DEFINE GWL_STYLE -16
&GLOBAL-DEFINE BM_SETSTYLE 244 /*0x00F4*/
&GLOBAL-DEFINE WS_CHILD 1073741824 /*0x40000000L*/
&GLOBAL-DEFINE WS_VISIBLE 268435456 /*0x10000000L*/
&GLOBAL-DEFINE WS_CLIPSIBLINGS 67108864 /*0x04000000L*/
&GLOBAL-DEFINE BS_PUSHBUTTON 0 /*0x00000000L*/
&GLOBAL-DEFINE BS_DEFPUSHBUTTON 1 /*0x00000001L*/
&GLOBAL-DEFINE BS_CHECKBOX 2 /*0x00000002L*/
&GLOBAL-DEFINE BS_AUTOCHECKBOX 3 /*0x00000003L*/
&GLOBAL-DEFINE BS_RADIOBUTTON 4 /*0x00000004L*/
&GLOBAL-DEFINE BS_3STATE 5 /*0x00000005L*/
&GLOBAL-DEFINE BS_AUTO3STATE 6 /*0x00000006L*/
&GLOBAL-DEFINE BS_GROUPBOX 7 /*0x00000007L*/
&GLOBAL-DEFINE BS_USERBUTTON 8 /*0x00000008L*/
&GLOBAL-DEFINE BS_AUTORADIOBUTTON 9 /*0x00000009L*/
&GLOBAL-DEFINE BS_OWNERDRAW 11 /*0x0000000BL*/
&GLOBAL-DEFINE BS_LEFTTEXT 32 /*0x00000020L*/
&GLOBAL-DEFINE BS_TEXT 0 /*0x00000000L*/
&GLOBAL-DEFINE BS_ICON 64 /*0x00000040L*/
&GLOBAL-DEFINE BS_BITMAP 128 /*0x00000080L*/
&GLOBAL-DEFINE BS_LEFT 256 /*0x00000100L*/
&GLOBAL-DEFINE BS_RIGHT 512 /*0x00000200L*/
&GLOBAL-DEFINE BS_CENTER 768 /*0x00000300L*/
&GLOBAL-DEFINE BS_TOP 1024 /*0x00000400L*/
&GLOBAL-DEFINE BS_BOTTOM 2048 /*0x00000800L*/
&GLOBAL-DEFINE BS_VCENTER 3072 /*0x00000C00L*/
&GLOBAL-DEFINE BS_PUSHLIKE 4096 /*0x00001000L*/
&GLOBAL-DEFINE BS_MULTILINE 8192 /*0x00002000L*/
&GLOBAL-DEFINE BS_NOTIFY 16384 /*0x00004000L*/
&GLOBAL-DEFINE BS_FLAT 32768 /*0x00008000L*/
&GLOBAL-DEFINE BN_CLICKED 0
&GLOBAL-DEFINE BN_DBLCLK 5
&GLOBAL-DEFINE BN_SETFOCUS 6
&GLOBAL-DEFINE BN_KILLFOCUS 7
DEFINE INPUT PARAMETER piHwnd AS INTEGER NO-UNDO.
DEFINE VARIABLE iTipus AS INTEGER NO-UNDO.
RUN GetWindowLongA (piHwnd,{&GWL_STYLE},OUTPUT iTipus) .
ASSIGN iTipus = iTipus + {&BS_MULTILINE}.
RUN SetWindowLongA (piHwnd,{&GWL_STYLE},iTipus).
RUN SendMessageA (piHwnd,{&BM_SETSTYLE},iTipus,1).
END PROCEDURE.
PROCEDURE disable_UI :
/*------------------------------------------------------------------------------
Purpose: DISABLE the User Interface
Parameters: <none>
Notes: Here we clean-up the user-interface by deleting
dynamic widgets we have created and/or hide
frames. This procedure is usually called when
we are ready to "clean-up" after running.
------------------------------------------------------------------------------*/
/* Delete the WINDOW we created */
IF SESSION

THEN DELETE WIDGET wWin.
IF THIS-PROCEDURE

END PROCEDURE.
PROCEDURE enable_UI :
/*------------------------------------------------------------------------------
Purpose: ENABLE the User Interface
Parameters: <none>
Notes: Here we display/view/enable the widgets in the
user-interface. In addition, OPEN all queries
associated with each FRAME and BROWSE.
These statements here are based on the "Other
Settings" section of the widget Property Sheets.
------------------------------------------------------------------------------*/
ENABLE BUTTON-1 BUTTON-2
WITH FRAME fMain IN WINDOW wWin.
{&OPEN-BROWSERS-IN-QUERY-fMain}
VIEW wWin.
END PROCEDURE.
PROCEDURE exitObject :
/*------------------------------------------------------------------------------
Purpose: Window-specific override of this procedure which destroys
its contents and itself.
Notes:
------------------------------------------------------------------------------*/
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN.
END PROCEDURE.