Localising ⎕WX within a Form-based class

Using (or providing) components based on the "Win32" framework

Localising ⎕WX within a Form-based class

Postby sjt on Tue Dec 23, 2014 3:54 pm

Setting a local value of ⎕WX within a form-based class seems insufficient to expose the form's properties.
      )ED ○ Gui
:Class Gui: 'Form'
∇ make0
:Access Public
:Implements Constructor
⎕WX←1
Caption←'Gui'

∇ r←ReportWX
:Access Public Instance
r←⎕WX

:EndClass

⎕WX←1
g←⎕NEW Gui ⍝ form Caption is 'Gui'
g.ReportWX
1
⎕WX←0
g←⎕NEW Gui ⍝ form Caption is empty
g.ReportWX
1
#.APLVersion
Windows 14.0.21763.0 W Development

Localising ⎕WX to the methods makes no difference. It is as if the effective value of ⎕WX is the root value in the root, not the namespace value.

Something I'm missing?
sjt
 
Posts: 21
Joined: Fri Nov 05, 2010 6:26 am

Re: Localising ⎕WX within a Form-based class

Postby Morten|Dyalog on Wed Dec 24, 2014 8:25 am

You are correct: It is the value of ⎕WX in the environment where an object is instantiated which decides the behaviour; the rationale being that this switch controls "how the object will look from there". Once the object is created, setting ⎕WX inside it only controls the behaviour of any objects that it in turn creates.

One possible work-around for this would be to wrap your classes in a namespace:

Code: Select all
:Namespace WX1
     ⎕WX←1
     :Class Gui : 'Form'
     ...
     :EndClass
:EndNamespace


For the record, Dyalog strongly recommends using the default ⎕WX of 3 and not modifying it, if at all possible.

P.S. I can see that the F1 help for ⎕WS could do with clarification, at the moment it can be read as the exact opposite of what was intended.
User avatar
Morten|Dyalog
 
Posts: 318
Joined: Tue Sep 09, 2008 3:52 pm

Re: Localising ⎕WX within a Form-based class

Postby Morten|Dyalog on Wed Dec 24, 2014 11:32 am

Further research reveals that I haven't got that QUITE right; you CAN change ⎕WX for a "real" GUI object. However, I suspect that setting ⎕WX in the derived class does not impact ⎕WX in the base class - you can only decide that once, by having the right ⎕WX when you perform the instatiation.
User avatar
Morten|Dyalog
 
Posts: 318
Joined: Tue Sep 09, 2008 3:52 pm

Re: Localising ⎕WX within a Form-based class

Postby Morten|Dyalog on Wed Dec 24, 2014 12:19 pm

... And it looks as if my work-around doesn't work either, sorry about that. I think I should take a couple of days off and have a chat with a couple of experts here before I continue.

Merry Christmas to those of you who celebrate it - and a Really Good Rest of the Week to everyone else!
User avatar
Morten|Dyalog
 
Posts: 318
Joined: Tue Sep 09, 2008 3:52 pm


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest