Very basic issue I'm struggling with.

Posted by ojfoggin on 24-Jul-2009 09:12

I'm trying to write a basic window using .NET gui, mainly as a learning opportunity and to then start to create something a  bit more advanced.

My background is Java so the OO side of it is very familiar to me but I am struggling at the first hurdle.

Using a .NET Dialog I can access our AppServer and get things displayed and all that stuff but when I try to use a form it shouts at me whenever I try to display it.

The instantiating program is an ABL .w window and the code goes thus...


[on choose of BtnOK]


DEF VAR rForm AS CLASS MyForm NO-UNDO.

rForm = NEW MyForm(this-procedure).

This bit works fine but doesn't display anything.  If I then try this (either from the .NET class side or the instantiating procedure side)...


rDialog:VISIBLE = TRUE.

The window becomes visibIe but I get a message telling me that I have to use WAIT-FOR in the ABL and can't use anything else.

I just don't know what I need to WAIT-FOR...

WAIT-FOR rForm:????????? ( ).

Please can someone help?

Thanks!

Oliver

All Replies

Posted by Admin on 24-Jul-2009 09:19

WAIT-FOR rDialog:ShowDialog () .

might work. It may happen, that the WAIT-FOR statement in your main window (.w) file needs to be changed as well (the menu program, the only program which is not persistent). It should be

WAIT-FOR System.Windows.Forms.Application:Run ().

and to exit the Application (CLOSE OF THIS-PROCEDURE in the main .w file) you need to do

System.Windows.Forms.Application:Exit ().

.NET Controls need to run in a .NET message loop.

Posted by ojfoggin on 24-Jul-2009 09:29

YES!

Thank you!

At last I can run things in a non-modal way

The problem I was having was that I needed the System.Windows.Forms.Application:RUN(rForm).

I was using Application:RUN(rForm) and it couldn't compile it.

Thanks again!

Posted by Admin on 24-Jul-2009 09:32

ojfoggin schrieb:

I was using Application:RUN(rForm) and it couldn't compile it.

Do you have the exact message? Application:Run belongs in a WAIT-FOR Statement. I guess that's the error you got.

Posted by ojfoggin on 24-Jul-2009 09:36

Sorry, what I meant was.

I was trying to use...

wait-for Application:RUN(rForm).

and the compiler shouted at me because it didn't know the variable Application.

The origianl message when I was trying to do rForm:visible = true was...

You can only use a .NET-specific input-blocking statement (WAIT-FOR x:y()) once any .NET forms are shown (other than to wait for an ABL dialog box).

(13967)

Thanks again

Posted by Admin on 24-Jul-2009 09:43

USING System.Windows.Forms.*. 

might help.

Posted by Peter Judge on 24-Jul-2009 09:45

wait-for Application:RUN(rForm).

and the compiler shouted at me because it didn't know the variable Application.

Using is your friend, as in

USING System.Windows.Forms.*.

Although in this case, I would suggest you always use the fully-qualified name, since there are a number of apps out there with a "System" table in their DB (there are a couple of posts here related to that).

-- peter

Posted by Admin on 24-Jul-2009 09:49

Although in this case, I would suggest you always use the fully-qualified name, since there are a number of apps out there with a "System" table in their DB (there are a couple of posts here related to that).

-- peter

Couldn't have said better :-) Application on it's own may be a conflict as well.

Posted by ojfoggin on 27-Jul-2009 04:30

Thanks guys I'll keep that in mind for the future!

This thread is closed