How to SetUp a Simple Event in WPF ?

Using (or providing) Microsoft.NET Classes

How to SetUp a Simple Event in WPF ?

Postby PGilbert on Mon Mar 11, 2013 9:03 pm

Why the following is not working ? (Using Version: 13.1.14265.0 32 Unicode and .Net 4.0)

      ⎕USING←'System.Windows,WPF/PresentationFramework.dll'
win←⎕NEW Window
btn←⎕NEW Controls.Button
btn.onClick←⎕OR ⎕FX 'bnOnClick' '⎕←''the button was clicked'''
win.Content←btn
win.Show


there is nothing written in the session when you click on the button.

Thanks in advance
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: How to SetUp a Simple Event in WPF ?

Postby MikeHughes on Tue Mar 12, 2013 7:11 am

Hi Pierre

WPF / .Net is very strict about spotting functions/methods with the correct signature

Even if you dont use it - your function must have a right argument or the signature is wrong and WPF ignores it

so if you change it to
btn.onClick←⎕OR ⎕FX 'bnOnClick ra' '⎕←''the button was

it should work - not tried it though
User avatar
MikeHughes
 
Posts: 86
Joined: Thu Nov 26, 2009 9:03 am
Location: Market Harborough, Leicestershire, UK

Re: How to SetUp a Simple Event in WPF ?

Postby PGilbert on Tue Mar 12, 2013 2:03 pm

Hello Mike, your suggestion does not work for me. The problem is that I have many functions that were using a simple event like I described in the post and now none of them are working anymore. I don't know what is broken, if it is .Net that has changed something or it is a new version of Dyalog. That is my real question.
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: How to SetUp a Simple Event in WPF ?

Postby DanB|Dyalog on Tue Mar 12, 2013 7:36 pm

I have no problem doing this.
It also works if I don't use []OR as in
btn.onClick← ⎕FX 'bnOnClick' '⎕←''the button was'''

I am using v4.0.30319
DanB|Dyalog
 

Re: How to SetUp a Simple Event in WPF ?

Postby PGilbert on Wed Mar 13, 2013 1:20 am

Thanks Dan for trying it. Looks like that I had .Net 4.5 installed on my computer. So I did the following:

1. Repair .Net 4.5 (still not working)
2. Remove .Net 4.5 (it is removing 4.0 at the same time and I fall to .Net 3.5)
3. Re-Install .Net 4.0

... and the good news is that the simple callback are working again.

If someone with .Net 4.5 could try the code and report here if it is working.

Thanks.
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: How to SetUp a Simple Event in WPF ?

Postby MikeHughes on Wed Mar 13, 2013 8:45 am

Ah I remember now

There are some new .Net dlls on the DSS page - it was reported under a DSS update email that the .Net dlls didnt work with .Net 4.5 so some new ones were created by Dyalog.

There are several changes to the .Net dlls and it would be worth updating these through DSS if you have a subscription or speak to support@dyalog.com
User avatar
MikeHughes
 
Posts: 86
Joined: Thu Nov 26, 2009 9:03 am
Location: Market Harborough, Leicestershire, UK

Re: How to SetUp a Simple Event in WPF ?

Postby PGilbert on Wed Mar 13, 2013 10:22 am

Thanks Mike for the support, will do.
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada


Return to Microsoft.NET

Who is online

Users browsing this forum: No registered users and 1 guest