|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242,
Visits: 828
|
|
| Hi, I have a problem to define data source for a combobox-column in DataGridView. The context should be current object of the DataGridView, but not the current *selected* object, so I can't use CurrencyManagerHandle. If I could define a Nesting and use it as DataSource for ComboBox column....
/Efim
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242,
Visits: 828
|
|
| Perhaps I was a bit fuzzy formulating my problem? Example: Person 0..1 ------ 1..0 Person (refleksiv). One limitation: a person can't be linked to itself. Let's say allpersons are listed in DataGridView with Datasource Person.allInstances. There is a combobox-column in the grid to select a person to be linked with. What should be Datasource for this column? Something like Paerson.allInstances->excluding (self), but how to achieve the context "current person"?
/Efim
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230,
Visits: 1 382
|
|
You only need this for the current row, right? that is the only one that can be in edit mode... If you ahve a currencymanagerHandle you can get the currently selected element, and from there it should be easy to define an expressionhandle with the correct list.
/Jonas Hogstrom [CapableObjects]
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2011-07-14 17:05:00
Posts: 290,
Visits: 2 617
|
|
efim (2008-10-17) Perhaps I was a bit fuzzy formulating my problem?
Example: Person 0..1 ------ 1..0 Person (refleksiv). One limitation: a person can't be linked to itself.
Let's say allpersons are listed in DataGridView with Datasource Person.allInstances. There is a combobox-column in the grid to select a person to be linked with. What should be Datasource for this column? Something like Paerson.allInstances->excluding (self), but how to achieve the context "current person"?
You answered your own question :-) You use one handle for the Person.allInstances in the grid, a CurrencyManagerHandle to specify the selected row as the context for another handle, and in that other handle do Person.allInstances->excluding(self)
Pete
====
Pete
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242,
Visits: 828
|
|
| I made a small example to demonstrate the problem. If I click button "Person.allInstances" everything works. But ckicking "Person.allInstances->excluding (self)" leads to some unpleasent things. I think you could reproduce it at your environment too.
/Efim
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242,
Visits: 828
|
|
| Hi gurus;-) Has anybody looked into the example? I'm very curious what is the problem
/Efim
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-27 18:06:44
Posts: 189,
Visits: 777
|
|
Hi Efim,
You aren't wrong. It does seem to go rather wrong once you've pressed that button.
Might be worth submitting as a bug.
Scott
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242,
Visits: 828
|
|
| Hi Scott! Thanks for your insight in the example. Before I go to Mantis I want to understand if CurrencyManagerHandle may be used in this situation at all. As Jonas mentions, yes, because OCL expression of comboBox DataSource is evaluated only for current grid line which is in edit mode. But this example lets suppose, it is evaluated for each line with the mouse over it, could you observe this behaviour? If so, it's clear why error comes, but I don't see any solution for the situation.
/Efim
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230,
Visits: 1 382
|
|
I ran the sample too and it doesn't seem to behave as expected. Please submit this as a bug in mantis and I'll take a closer look at it.
/Jonas Hogstrom [CapableObjects]
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242,
Visits: 828
|
|
|