HELP please - syntax for new class ...... >>

This forum is meant for anything you would like to share with other visitors
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

HELP please - syntax for new class ...... >>

Post by Phil Hepburn »

Hi Wolfgang,

I was wondering when you would get around to telling me this ;-0)

The truth is that I have been so busy trying to get other stuff done (based on Nick's DevShare 2015 sample etc.), that I just did not get around to finding a better solution to the Property definition, also I was fitting my code into Robert's example which already had a Field declared, so I needed to use the same name as that. If I recall correctly I tried 'auto' and it did not work the way I required it to, but there may have been another reason for that.

Everywhere else I do use 'auto' for Get/Set.

I may revisit this topic later this morning, when I am going to try the Generic sample of a "Stack of Stacks" - I will make Stacks of INT, DateTime, String, Decimal and Enum items, and then Push these stacks into another 'outer' Stack. Was an idea I had in bed ;-0)

Speak soon,
Phil.
NickFriend
Posts: 248
Joined: Fri Oct 14, 2016 7:09 am

HELP please - syntax for new class ...... >>

Post by NickFriend »

Phil Hepburn wrote:Hi Wolfgang,
I will make Stacks of INT, DateTime, String, Decimal and Enum items, and then Push these stacks into another 'outer' Stack. Was an idea I had in bed ;-0)
Phil, I'm worried, you may need to re-evaluate your work life balance!!! ;-)

Nick
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

HELP please - syntax for new class ...... >>

Post by Phil Hepburn »

Hi Wolfgang,

Okay then, I have taken some time to start coding the Properties as you recently suggested.

Here is my first attempt along your single line approach :-
WR_GetSet_01.jpg
WR_GetSet_01.jpg (74.66 KiB) Viewed 274 times
As a matter of interest, is there a way of having a compound (or more complex) 'SET' clause ?

And here is the line in action with three different Types of myStack :-
WR_GetSet_02.jpg
WR_GetSet_02.jpg (79.53 KiB) Viewed 274 times
I am having syntax problems trying to have a Stack of my Stacks ! More on that later.

Cheers,
Phil.
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

HELP please - syntax for new class ...... >>

Post by Phil Hepburn »

Nick,

For starters, who ever suggested that I was balanced ?

Secondly, if you were retired you would realise that there are an awful lot of hours in a week.

And on top of that I have been stuck in the middle of a local power and politics 'squeeze' it would seem. So because my four year term of Governorship has come to an end, I am not being invited back. No one can seemingly tell me why. So even more time to kill!

Life is rather strange currently, both local, national and global. I am sure we can't meaningfully blame Microsoft for that, although a few guys down the pub (at least one left) will give it a try. Oh! and a guy in the Netherlands too. (Guess who.)

Speak soon,
Phil.

P.S. If I have a class of ' myStack<T> ' how do I code things such that I can have a stack of stacks ? After all we can have arrays of arrays, and lists or lists. It seems to be the Generic 'bit' that causes the issue(s).
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

HELP please - syntax for new class ...... >>

Post by wriedmann »

Hi Phil,
As a matter of interest, is there a way of having a compound (or more complex) 'SET' clause ?
of course. You can separate them by commas. Personally I prefer to write the extensive form of property when I have more complex set clauses, but this sample from my base ComboBox class works:

Code: Select all

public new property Name as string get super:Name set super:Name := value, self:SetupBinding()
Wolfgang

P.S. if you are curious what I do in the SetupBinding method:

Code: Select all

method SetupBinding() as void
local oBinding as Binding

  oBinding := Binding{ self:Name } 
  oBinding:ValidatesOnDataErrors := true
  oBinding:UpdateSourceTrigger := UpdateSourceTrigger.PropertyChanged

  self:SetBinding( ComboBox.TextProperty, oBinding )
	
  return
It is really name based binding that we all know from VO <g>
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply