Welcome to the XSharp News Server and Forum

You are welcome to participate in the XSharp newsgroups and forum.

The XSharp News Server can be found at news.xsharp.info, port 119 (nntp). You can login with the user name XSharpUser and password X#Rulez!.
You can also post through the web interface. In that case you need to create a user account first.
The newsgroups and web interface are not synchronized yet. We are working on that.

When posting to the newsgroups and forums we ask you kindly to follow the rules that you can find here: https://www.xsharp.info/faq/39-xsharp-news-server-rules

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

More
2 days 20 hours ago - 2 days 20 hours ago #1 by Wolfgang Riedmann
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:
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:
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>
Last Edit: 2 days 20 hours ago by Wolfgang Riedmann.

Please Log in to join the conversation.

  • Phil Hepburn
  • Phil Hepburn's Avatar Topic Author
  • Away
More
2 days 20 hours ago #2 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).

Please Log in to join the conversation.

  • Phil Hepburn
  • Phil Hepburn's Avatar Topic Author
  • Away
More
2 days 20 hours ago #3 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 :-



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 :-



I am having syntax problems trying to have a Stack of my Stacks ! More on that later.

Cheers,
Phil.
Attachments:

Please Log in to join the conversation.

More
3 days 48 minutes ago #4 by Nick Friend

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

Please Log in to join the conversation.

  • Phil Hepburn
  • Phil Hepburn's Avatar Topic Author
  • Away
More
3 days 57 minutes ago #5 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.

Please Log in to join the conversation.

More
3 days 6 hours ago #6 by Wolfgang Riedmann
Hi Phil,

these days I like the short property syntax much more:
property Items a T[] get self:_Items set self:_Items := value

Or, since your Items property is get/set, you could use an auto property:
property Items as T[] auto

Fortunately X# gives us a lot of possibilities to write code....

Wolfgang

Please Log in to join the conversation.

Time to create page: 1.400 seconds