DataGridView with Combobox-column
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



DataGridView with Combobox-column Expand / Collapse
Author
Message
Posted 2008-10-16 15:27:09
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #593
Posted 2008-10-17 19:18:53
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #599
Posted 2008-10-17 21:29:27
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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]
Post #600
Posted 2008-10-18 12:21:09
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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
Post #601
Posted 2008-10-19 23:15:30
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #608
Posted 2008-10-22 18:43:10
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #622
Posted 2008-10-22 19:42:57
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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
Post #623
Posted 2008-10-22 21:19:40
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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

Post #624
Posted 2008-10-23 02:15:37
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme 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]
Post #627
Posted 2008-10-23 09:49:02
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2012-01-26 14:59:09
Posts: 242, Visits: 828
Done

/Efim
Post #630
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 11:34

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,266. 10 queries. Compression Disabled.