Flat Fill-In Widget

frafati

New Member
Hello all,

1 - Is it possible to change the appearances of a dynamically create Fill-in Widget to flat, with border? (Native attribute will not do)

2- is it possible to create/instantiate Active-x controls dynamically?

Thank you for your responses
 
Hi,

You can add OCX controls dynamically. see below for the sample procedure.; My Progress Environment is Progress 9.1D.

Hope this helps.

Sample Code:

DEFINE VARIABLE OCXFile AS CHARACTER NO-UNDO.
OCXFile = SEARCH( "{&FILE-NAME}.wrx":U ).
IF OCXFile = ? THEN
OCXFile = SEARCH(SUBSTRING(THIS-PROCEDURE:FILE-NAME, 1,
R-INDEX(THIS-PROCEDURE:FILE-NAME, ".":U), "CHARACTER":U) + "wrx":U).
IF OCXFile <> ? THEN
DO:
ASSIGN
chCtrlFrame = CtrlFrame:COM-HANDLE
UIB_S = chCtrlFrame:LoadControls( OCXFile, "CtrlFrame":U)
.
RUN initialize-controls IN THIS-PROCEDURE NO-ERROR.
END.
ELSE MESSAGE "{&FILE-NAME}.wrx":U SKIP(1)
"The binary control file could not be found. The controls cannot be loaded."
VIEW-AS ALERT-BOX TITLE "Controls Not Loaded".
&ENDIF
END PROCEDURE.

Thanks,
Ajay.
 
ajaysheth,

Thank you very much for your reply. I came to the same technique yesterday to instantiate multiple object of an OCX. Here below is the code that I used ( a little different from your example), it might be usefull for other members with similar question.
And Thanks again.

NOTE:
For this code to work you have to implicitly create a Frame and add the Textbox OCX to the frame in your Main window/dialog. The Frame will provide the ReSizing capability.

PROCEDURE CreateTextBox:

DEF INPUT PARAMETER iX AS INTEGER NO-UNDO.
DEF INPUT PARAMETER iY AS INTEGER NO-UNDO.
DEF INPUT PARAMETER iDX AS INTEGER NO-UNDO.
DEF INPUT PARAMETER iDY AS INTEGER NO-UNDO.
DEF INPUT PARAMETER cCaption AS CHARACT NO-UNDO.
DEF OUTPUT PARAMETER hFrame AS HANDLE NO-UNDO.
DEF OUTPUT PARAMETER hCtrl AS HANDLE NO-UNDO.
DEF OUTPUT PARAMETER hCom AS COM-HANDLE NO-UNDO.

DEFINE VARIABLE UIB_S AS LOGICAL NO-UNDO.
DEFINE VARIABLE OCXFile AS CHARACTER NO-UNDO.
OCXFile = SEARCH("{&FILE-NAME}.wrx":U).
IF OCXFile = ? THEN
OCXFile = SEARCH(SUBSTRING(THIS-PROCEDURE:FILE-NAME, 1,
R-INDEX(THIS-PROCEDURE:FILE-NAME, ".":U), "CHARACTER":U) + "wrx":U).
IF OCXFile <> ? THEN
DO:
/** Create a frame to use it's resize and moveable feature **/
CREATE FRAME hFrame
ASSIGN
FRAME = FRAME f-PageLayout:HANDLE
ROW = iX
COLUMN = iY
HEIGHT = iDY
WIDTH = iDX
HIDDEN = no
SENSITIVE = yes
SELECTABLE = TRUE
MOVABLE = TRUE
RESIZABLE = TRUE
TRIGGERS:
ON END-RESIZE PERSISTENT RUN TextFieldResized IN THIS-PROCEDURE (hFrame).
END TRIGGERS.
/** Create a control container and load the ocx **/
CREATE CONTROL-FRAME hCtrl ASSIGN
FRAME = hFrame
ROW = 1
COLUMN = 1
HEIGHT = hFrame:HEIGHT - 1
WIDTH = hFrame:WIDTH - 1
HIDDEN = no
SENSITIVE = yes.
hCtrl:NAME = "MyText".
ASSIGN
hCom = hCtrl:COM-HANDLE
UIB_S = hCom:LoadControls( OCXFile, "CtrlFrame":U)
hFrame:PRIVATE-DATA = "PRIVATE-DATA"
.
RUN initialize-controls IN THIS-PROCEDURE NO-ERROR.
END.
ELSE MESSAGE "{&FILE-NAME}.wrx":U SKIP(1)
"The binary control file could not be found. The controls cannot be loaded."
VIEW-AS ALERT-BOX TITLE "Controls Not Loaded".

END PROCEDURE.




ajaysheth said:
Hi,

You can add OCX controls dynamically. see below for the sample procedure.; My Progress Environment is Progress 9.1D.

Hope this helps.

Sample Code:

DEFINE VARIABLE OCXFile AS CHARACTER NO-UNDO.
OCXFile = SEARCH( "{&FILE-NAME}.wrx":U ).
IF OCXFile = ? THEN
OCXFile = SEARCH(SUBSTRING(THIS-PROCEDURE:FILE-NAME, 1,
R-INDEX(THIS-PROCEDURE:FILE-NAME, ".":U), "CHARACTER":U) + "wrx":U).
IF OCXFile <> ? THEN
DO:
ASSIGN
chCtrlFrame = CtrlFrame:COM-HANDLE
UIB_S = chCtrlFrame:LoadControls( OCXFile, "CtrlFrame":U)
.
RUN initialize-controls IN THIS-PROCEDURE NO-ERROR.
END.
ELSE MESSAGE "{&FILE-NAME}.wrx":U SKIP(1)
"The binary control file could not be found. The controls cannot be loaded."
VIEW-AS ALERT-BOX TITLE "Controls Not Loaded".
&ENDIF
END PROCEDURE.

Thanks,
Ajay.
 
You can get a flat standard 4GL FILL-IN widget simply by switching off the 3D attribute on the frame.

The only problem is that the frame background colour will be set to white when you switch 3D mode off. So, all you need to do is reset the frame background colour to the windows "buttonface" colour and you're done.

Of course you'll have to map the RGB values of the windows colours into the Progress colour table first! If you don't know how to do this, download SmartPak from www.smartpak.pwp.blueyonder.co.uk and have a look at the {color.i} include file.

Using SmartPak, it's pretty easy. Just include {color.i} in your Window or Dialog, and in the main-block, set the colors of the frame and the FILL-IN widgets (because they always inherit the frame colour).

FRAME {&FRAME-NAME}:3D = FALSE.

FRAME {&FRAME-NAME}:BGCOLOR = COLOR-OF("ButtonFace").

FILL-IN-1:BGCOLOR = COLOR-OF("Window").
 
Back
Top