How to create dynamic MyHover.ocx (button) using PROGRESS 4GL

djohan

New Member
Hi,

I am using OpenEdge 10.2B and download ocx button. it called MyHover.ocx. This ocx is already work when using AppBuilder.

But i failed to create MyHover.ocx using Procedure Editor ( Progress 4GL) as i want to create it dynamically.
Is anyone can help me ? I am very appriciated if can give me an example program.

Thanks in advance.

Regards with SMILE,

Djohan
 

RealHeavyDude

Well-Known Member
I just can tell you why it does not work: The integration with OCX is static in that the AppBuilder creates a control frame when you drop an OCX onto a Progress frame as an interface to the OCX. Furthermore it automatically creates a file with the same name as the 4GL program but with an extension of wrx. That are the steps that you are missing and I don't know whether you could achieve them dynamically at run time but I doubt it.

Instead you would need OLE automation integration - which, IMHO of course, might not make that much sense for a user interface widget.

Maybe somebody else knows how you can work around this.

Heavy Regards, RealHeavyDude.
 

djohan

New Member
Hi RealHeavyDude,
Thanks for your reply.

Hi Cringer,
These are the answer:
1. Progress OpenEdge Studio 10.2B No Service Pack
2. Windows XP SP 3
3. Just now i succeed to create 2 button MyHover dynamically.

The Steps as follows:
A. Create .wrx file.
1. Using Appbuilder, Create Window
2. Put the MyHover ocx button
3. Save file . ie. c-win.w

B. Create program to create Myhover ocx button dynamically.
The Simple Program as follow:
================================================================================================
DEFINE VARIABLE CtrlFrame AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE chCtrlFrame AS COMPONENT-HANDLE NO-UNDO.
DEFINE VARIABLE UIB_S AS LOGICAL NO-UNDO.
DEFINE VARIABLE OCXFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE CtrlFrame-2 AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE chCtrlFrame-2 AS COMPONENT-HANDLE NO-UNDO.




OCXFile = SEARCH( "c-win.wrx":U ).

DEFINE FRAME frame01
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 80 BY 16 WIDGET-ID 100.


CREATE CONTROL-FRAME CtrlFrame ASSIGN
FRAME = FRAME FRAME01:HANDLE
ROW = 2
COLUMN = 14
HEIGHT = 1
WIDTH = 15
HIDDEN = no
SENSITIVE = yes.


CREATE CONTROL-FRAME CtrlFrame-2 ASSIGN
FRAME = FRAME FRAME01:HANDLE
ROW = 3
COLUMN = 14
HEIGHT = 1
WIDTH = 15
HIDDEN = no
SENSITIVE = yes.




ASSIGN
chCtrlFrame = CtrlFrame:COM-HANDLE
UIB_S = chCtrlFrame:LoadControls( OCXFile, "CtrlFrame":U)
CtrlFrame:NAME = "CtrlFrame":U
chCtrlFrame-2 = CtrlFrame-2:COM-HANDLE
UIB_S = chCtrlFrame-2:LoadControls( OCXFile, "CtrlFrame":U)
CtrlFrame-2:NAME = "CtrlFrame-2":U
.


VIEW FRAME frame01.

=========================================================================================

Right now, i want to make the above program more eficient as the variable for widget-handle and com-handle should i create as much as how many button that i want to create

If anyone have another opinion about my program, please let me know.

Regards with SMILE,

Djohan
 

RealHeavyDude

Well-Known Member
One can learn something new every day - I did not think that it is possible ... hats off to you!

Instead of creating YASOV (yet another slew of variables) I would keep track of the buttons in a Temp-Table that contains 1 record per button.

Heavy Regards, RealHeavyDude.
 

Cringer

ProgressTalk.com Moderator
Staff member
Agreed RHD - a temp-table is definitely the best course of action for all the handles.
 
Top