Welcome
Welcome to MicroAPL's Support Forum for APLX.


You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, join our community today!

How To Get Some Text Written in the WS With a Click Event

Using classes written in the .Net languages (C#, Visual Basic, etc)

How To Get Some Text Written in the WS With a Click Event

Postby PGilbert on Tue Aug 04, 2009 4:55 pm

The following function (TEST_EVENT):

TEST_EVENT;Form;Button;sink

Form ← '.Net' ⎕NEW 'Form'
Form.Size ← '.Net' ⎕NEW 'Size' 220 90
Form.Text ← 'Click Event Test'

Button ← '.Net' ⎕NEW 'Button'
Button.Text ← 'Click Me'
Button.Click ← "'Button was Clicked'"

Form.Controls.Add Button

Form.Show

:While Form.Visible
sink ← ⎕WE 0.1
:EndWhile


...will generate the following Window:

click_event_test.png
click_event_test.png (5.77 KiB) Viewed 26 times


when you click on the button I would expect that the phrase 'Button was Clicked' to be written in the Workspace but it's not. However, if the Click event is calling a function, and the function write 'Button was Clicked' it will work fine. Is this a limitation of .Net event or I am doing something wrong ?

Regards,

Pierre Gilbert

Using: Windows XP and APLX v5 Beta
PGilbert
 
Posts: 59
Joined: Thu Jul 10, 2008 8:34 pm
Location: Montreal, Quebec, Canada

Re: How To Get Some Text Written in the WS With a Click Event

Postby MicroAPL on Tue Aug 04, 2009 7:00 pm

For event handlers within ⎕WE, the expression is evaluated and any result is thrown away.

So to output the text to the session window, you need something like:

Button.Click ← "⎕←'Button was Clicked'"
MicroAPL
Site Admin
 
Posts: 166
Joined: Tue Jul 08, 2008 5:25 pm

Re: How To Get Some Text Written in the WS With a Click Event

Postby PGilbert on Tue Aug 04, 2009 8:00 pm

Thanks for your answer, indeed it is working now with your suggestion.

Thanks again,

Pierre Gilbert
PGilbert
 
Posts: 59
Joined: Thu Jul 10, 2008 8:34 pm
Location: Montreal, Quebec, Canada


Return to Interfacing to .Net