MauditOstie
Member
Hi Everyone,
I have a Smart Window built as such:
1 - Smart Object called h_Toolbar.
1 - Smart Object called h_viewer1.
1 - Smart Object called h_browser1.
The browser currently is my query.
The Toolbar has some buttons created as such:
I was wandering, since i know the PCKEY of the button, how do you think i can call the button from my Smartwindow?
How do i call that specific button? I know there is a Trigger called OCX.ButtonClick that does the job but it needs the handle of the button and i don't know how to get that Handle from my smartwindow.
Here is the OCX.ButtonClick OF Frame CTRLFrameTB:
Thanks.
(Progress 10.2a).
I have a Smart Window built as such:
1 - Smart Object called h_Toolbar.
1 - Smart Object called h_viewer1.
1 - Smart Object called h_browser1.
The browser currently is my query.
The Toolbar has some buttons created as such:
Code:
PROCEDURE ADDBUTTON:
define input parameter piIndex as integer no-undo.
define input parameter pcKey as character no-undo.
define input parameter pcCaption as character no-undo.
define input parameter piStyle as integer no-undo.
define input parameter pcImage as character no-undo.
define input parameter pcTooltip as character no-undo.
define variable chButton as COM-HANDLE no-undo.
if piStyle = 3 or piStyle = 4 then do:
if piIndex = 0 then
chButton = chToolbar:Buttons:Add(,pcKey,,piStyle) .
else
chButton = chToolbar:Buttons:Add(piIndex,pcKey,,piStyle) .
RELEASE OBJECT chButton NO-ERROR.
chButton = ?.
return.
end.
if piIndex = 0 and pcKey = "":U and pcImage = "":U then
chButton = chToolbar:Buttons:Add(,,pcCaption,piStyle) .
else if piIndex = 0 and pcKey <> "":U and pcImage = "":U then
chButton = chToolbar:Buttons:Add(,pcKey,pcCaption,piStyle) .
else if piIndex = 0 and pcKey <> "":U and pcImage <> "":U then
chButton = chToolbar:Buttons:Add(,pcKey,,piStyle,pcImage) .
else if piIndex <> 0 and pcKey = "":U and pcImage = "":U then
chButton = chToolbar:Buttons:Add(piIndex,,pcCaption,piStyle) .
else if piIndex <> 0 and pcKey <> "":U and pcImage = "":U then
chButton = chToolbar:Buttons:Add(piIndex,pcKey,pcCaption,piStyle) .
else if piIndex <> 0 and pcKey <> "":U and pcImage <> "":U then
chButton = chToolbar:Buttons:Add(,pcKey,,piStyle,pcImage) .
ASSIGN
chButton:ToolTipText = pcToolTip
chButton:DESCRIPTION = pcTooltip
NO-ERROR.
RELEASE OBJECT chButton NO-ERROR.
chButton = ?.
END PROCEDURE.
I was wandering, since i know the PCKEY of the button, how do you think i can call the button from my Smartwindow?
How do i call that specific button? I know there is a Trigger called OCX.ButtonClick that does the job but it needs the handle of the button and i don't know how to get that Handle from my smartwindow.
Here is the OCX.ButtonClick OF Frame CTRLFrameTB:
Code:
/*------------------------------------------------------------------------------
Purpose:
Parameters: Required for OCX.
Button
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER p-Button AS COM-HANDLE NO-UNDO.
define variable cKeyName as character no-undo.
DEFINE VARIABLE hTempFocus AS HANDLE NO-UNDO.
if glHelpMode then do:
if valid-handle(ghHelpWaitFor) then
apply "U1":u to ghHelpWaitFor.
RELEASE OBJECT p-Button NO-ERROR.
return no-apply.
end.
else do:
cKeyName = p-button:KEY NO-ERROR.
IF cKeyName <> "":U then DO:
IF cKeyName = "Save":u THEN DO:
ASSIGN hTempFocus = FOCUS:PARENT no-error.
IF VALID-EVENT(hTempFocus,"ROW-LEAVE":U) THEN DO:
APPLY "ROW-LEAVE":U TO hTempFocus.
END.
END.
run execute-toolOCX in ghroutines (THIS-PROCEDURE, cKeyName, ?).
END.
end.
RELEASE OBJECT p-Button NO-ERROR.
p-Button = ?.
END PROCEDURE.
Thanks.
(Progress 10.2a).