Is it possible to create a data structure that is IDENTICAL to the “PAIR” structure
but instead of being LEFT:RIGHT it is ROW:COLUMN
I have an app that uses PAIR for dictionary keys, but it is getting confusing to keep LEFT is ROW and RIGHT is Column
especially with LEFT is a common attribute for controls, etc… makes it confusing to keep the LEFTS easy to discern when reading the code etc.
Note : I need it to work the same as PAIR, otherwise I have to change hundreds of lines of code
By “work the same” do you mean “must use the colon ( operator”?
Xojo doesn’t have an Operator_Tuple() does it? If it did, you could define your own types and call them using the colon notation.
if at all possible…
I have methods that accept pair as a parameter, and some that return pairs
would be optimal if I can replace “AS PAIR” with “AS customPAIR”
and then just change the .LEFT and .RIGHT
Keeping .LEFT and .RIGHT would be easy to do with a custom class.
What I don’t think would be possible would be for your custom class to do this:
Dim x as new CustomPair = 100: 200
you’d have to write it
Dim x as new CustomPair(100,200)
you mis-understand… I do NOT want to keep LEFT/RIGHT… I want ROW/COLUMN
Can you subclass Pair? Have your own Row/Column methods and just call the underneath left/right?
Didn’t think you could subclass a datatype
but how would that create a ROW:COLUMN ability?
Pair is a class. So maybe you can just add extension methods.
I am trying to create this overload… and XOJO IDE keeps crashing when attempting to define it
SUB KeyRow(byref key as pair, assigns new_value as variant)
FUNCTION KeyRow(key as pair) as variant
It allows me to create the first, but as soon as I attempt to create the 2nd, the IDE crashes, over and over again
NOTE : ONLY CRASHES IN XOJO 2015r1! works as it should in 2014r3.2
I’ve created this now 3 different ways in 2015r1
add 2 new methods
a) copied the declaration from your post for the SUB
b) add new method to a class
d) copied the declaration from your post for the FUNCTION
e) add new method to a class
variation on this where I copied pasted & added the code as well
added new method & typed in declarations
if it crashes, maybe we can see something in crash report?
Yeah, I don’t get a crash, but these methods in a module give me Row and Column accessors for Pair…
[code]Function Row(extends p As Pair) As Variant
Function Column(extends p As Pair) As Variant
AH OK I managed to reproduce this myself working on something else
seems like if Norm can reproduce the issue and opens the ticket himself, it gets fixed immediately… I need to get Norm to reproduce my errors in the future…
Being able to reproduce the error is 90% of fixing it.
I ran into this one while doing some other work & realized it was Dave’s issue
It is kind of tough to figure the steps to reproduce it and the fix was pretty quick
But yes , when I run into it it usually gets fixed ASAP if I can reproduce it right away
That’s not always the case
I accept Mastercard, PayPal and beer
I thought you didn’t drink beer? XDC is fast approaching so I should work more to get the cc balance down. I think I owe a few rounds…
Dave’s issue (which he apparently has 2 of now)
Me. Not drink beer ? You HAVE been to a conference haven’t you ?
Just have to duck Dana and the open bar police