I have embedded an openedge window in a .net form. The openedge window contains a few objects most importantly a browse.
I want to know how do I get a .NET widget e.g. Tick Box to talk to the openedge browse which is embedded so that when the .net tick box is ticked the browse is hidden and vice versa?
Thanks in advance for any help/guidance, Derek
stokiedez schrieb:
I have embedded an openedge window in a .net form. The openedge window contains a few objects most importantly a browse.
I want to know how do I get a .NET widget e.g. Tick Box to talk to the openedge browse which is embedded so that when the .net tick box is ticked the browse is hidden and vice versa?
Thanks in advance for any help/guidance, Derek
Well, any communication is possible using Triggers on the ABL browse widget, .NET event handlers or application logic level. It may just be an issue of getting the reference to the other objects/widgets.
Can you clarify your question: Where is the "tick box" located? In the same form that's embedding the ABL form? Do you have a screen-shot?
Thanks for your response,
I've attached a screenshot. I understand the principle of embedding I just cannot fathom how you can get the two technologies to talk to one another, I remember in the webinar a few months ago it was said that the widgets in an embedded window and .net widgets are separate from one another.
Derek
Well the .NET trigger event code is plain ABL so as long as you have the handle of the Progress browse / frame you can hide/view it from your CheckedChanged method.
I currently have two handles in the .p (one handle to the ablprocedure set to run my gui window & one to the ablwindow) which in turn is running the cls file. I take it I put a handle in my .w which is the openedge window that is embedded in the .net form?
Thanks
Sorry I lost you there.
Maybe you can make a simple drawing of what is running what like this:
a.p -> b.w -> c.cls
I have a .p which is running the openedge window (.w) persistently in a handle.
In the same .p I am assigning the window container attributes & hABLWindow1 to be the current window.
I've attached my code in-case I haven't explained myself well
Appreciate the help, thanks
DEFINE
VARIABLEMainForm AS Progress.Windows.Form.
DEFINE
VARIABLE hABLProcedure1 AS HANDLE NO-UNDO.
DEFINE
VARIABLE hABLWindow1 AS HANDLE NO-UNDO.
DEFINE
VARIABLE WinContainer1 AS Progress.Windows.WindowContainer.
DEFINE
VARIABLE windowSize1 AS Size.
MainForm =
NEW BasicForm1().
MainForm:
Text = "Sample Program".
MainForm:Show( ).
RUN
SampleProg.w PERSISTENT SET hABLProcedure1.
hABLWindow1 = hABLProcedure1:
CURRENT-WINDOW.
windowSize1 =
NEW Size (hABLWindow1:WIDTH-PIXELS, hABLWindow1:HEIGHT-PIXELS).
WinContainer1 =
NEW Progress.Windows.WindowContainer( ).
WinContainer1:Location =
NEW Point( 0, 60 ).
WinContainer1:
Parent = MainForm.
WinContainer1:EmbeddedWindow = hABLWindow1.
WinContainer1:
Size = windowSize1.
MainForm:FormClosed:
Subscribe("FormClosed").
WinContainer1:Show( ).
RUN
enable_UI IN hABLProcedure1.
WAIT-FOR
Application:Run(MainForm).
Seems to me you can add the following code in you CheckedChanged trigger:
hABLWindow1:HIDDEN = NOT CheckBox1:Checked.
For this you would need to change your code along the following lines passing in hABLWindow1 to the constructor of MainForm:
RUN SampleProg.w PERSISTENT SET hABLProcedure1.
hABLWindow1 = hABLProcedure1:CURRENT-WINDOW.
MainForm = NEW BasicForm1(hABLWindow1).
MainForm:Text = "Sample Program".
MainForm:Show( ).
If this means that hABLWindow1 becomes visible too early, you could alternatively pass in THIS-PROCEDURE to the constructor of MainForm so it can to a callback to the .p to retrieve hABLWindow1 from the CheckedChange trigger.
Message was edited by: Peter van Dam because my editor got mixed up when quoting code
I just managed to get the openedge window hiding/displaying as your message came through.
In terms of hiding/showing individual widgets though such as just the browse, rather than the browse & fill-ins, is this possible?
Thanks again
stokiedez wrote:
I just managed to get the openedge window hiding/displaying as your message came through.
In terms of hiding/showing individual widgets though such as just the browse, rather than the browse & fill-ins, is this possible?
Thanks again
Of course. All you need is the handle of the individual widget. Since you have the Window handle you can 'walk the widget tree' in order to find the handles of the contained widgets. Do you know how to do that?
I've heard the term but I'm unsure if I can do it, i've found some info on it and currently reading up how its done.
If I'm passing hABLWindow1 into the cls file BasicForm (MainForm = NEW BasicForm1(hABLWindow1).), where in the cls file do I reference the input parameter declaration?
Thanks, Derek
I would suggest to do this (if I understood this thread correctly):
- make a procedure in the .w (say DoTheStuff)
- implement the things you want to do in this DoTheStuff procedure
- from the .NET trigger: run DoTheStuff in hWindow (where hWindow is the handle of the .w)
This way you don't have to have knowledge in the .NET form(trigger) about the internals of the .w
hth,
Bronco
stokiedez wrote:
I've heard the term but I'm unsure if I can do it, i've found some info on it and currently reading up how its done.
If I'm passing hABLWindow1 into the cls file BasicForm (MainForm = NEW BasicForm1(hABLWindow1).), where in the cls file do I reference the input parameter declaration?
Thanks, Derek
Well, first of all, since you now want to manipulate more widgets and bearing in mind what Bronco wrote, I suggest you now pass in the procedure handle instead of the window handle:
RUN SampleProg.w PERSISTENT SET hABLProcedure1.
hABLWindow1 = hABLProcedure1:CURRENT-WINDOW.
MainForm = NEW BasicForm1(hABLProcedure1).
MainForm:Text = "Sample Program".
MainForm:Show( ).
MainForm will contain code like this:
DEFINE VARIABLE ghParent AS HANDLE NO-UNDO.
CONSTRUCTOR PUBLIC test (INPUT hParent AS HANDLE):
SUPER().
InitializeComponent().
ASSIGN
ghParent = hParent. /* save the parent handle */
CATCH e AS Progress.Lang.Error:
UNDO, THROW e.
END CATCH.
END CONSTRUCTOR.
Now you can put triggers like this in MainForm:
METHOD PRIVATE VOID checkBox1_CheckedChanged( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
RUN hideWindow IN ghParent.
RETURN.
END METHOD.
METHOD PRIVATE VOID checkBox2_CheckedChanged( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
RUN hideAnotherWidget IN ghParent.
RETURN.
END METHOD.
You create the methods hideWindow and hideAnotherWidget in your .w file where you have access to the widget handles. No need to walk the widget tree.
HTH
-peter
Since your browser is inside a persistent procedure, just add a method that will show/hide the browser and call that method inside the toggle-box value changed handler.