StrataFrame Forum

I want my enum to sort numerically, not alphabeltically

http://forum.strataframe.net/Topic30938.aspx

By Marcia G Akins - 2/20/2012

Hi all.

This one has to be simple. I have an enum for months of the year. I am populating a combo box iin my browse dialog from the enum. But when the browae dialog is displayed, it displays the months in alphabetical order, not the order in which they appear in the year.

What do I have to do to fix this?

TIA.

Marcia
By Edhy Rijo - 2/20/2012

Hi Marcia,

Marcia G Akins (2/20/2012)
What do I have to do to fix this?

I believe there is a Sort property in the combo that will allow you to control that issue.
By Marcia G Akins - 2/21/2012

Edhy Rijo (2/20/2012)
Hi Marcia,

Marcia G Akins (2/20/2012)
What do I have to do to fix this?

I believe there is a Sort property in the combo that will allow you to control that issue.


I did not see a setting for this in the BrowseDialog.
By Edhy Rijo - 2/21/2012

Hi Marcia,

Marcia G Akins (2/21/2012)I did not see a setting for this in the BrowseDialog.

Ooops, I missed the "BrowseDialog" part Crying  I believe the Combobox.Sorted property is not exposed in the BrowseDialog.
By Marcia G Akins - 2/21/2012

Edhy Rijo (2/21/2012)
Ooops, I missed the "BrowseDialog" part Crying  I believe the Combobox.Sorted property is not exposed in the BrowseDialog.


So are you telling me that there is no way to accomplish this?
By Edhy Rijo - 2/21/2012

Marcia G Akins (2/21/2012)
So are you telling me that there is no way to accomplish this?

Well, basically that I don't see a clear way to do this without modifying the SF Browser Dialog Source code to expose the ComboBox.Sorted property which would allow you to control the sorting at runtime.

I spend sometime with the BD trying to get to this property via any of the BD events, but could not find a way to do it.  Sorry!!! Crying
By Marcia G Akins - 2/21/2012

Edhy Rijo (2/21/2012)Well, basically that I don't see a clear way to do this without modifying the SF Browser Dialog Source code to expose the ComboBox.Sorted property which would allow you to control the sorting at runtime.

I spend sometime with the BD trying to get to this property via any of the BD events, but could not find a way to do it.  Sorry!!! Crying


That is really a damn nuisance. I have a field on my lookup tables called order_num and guess what it does? Very often , as in the case of months of the year, it makes no sense to sort things alphabetically. I am quite capable of making sure that the data is sorted the way that I want it.

-- Marcia
By Ivan George Borges - 2/21/2012

The combobox won't automatically sort a BO content when populated with it, so your order_num should be fine, you just need to use a FillMethod that brings the table on whatever order you need. For the enums, I guess you could use a dummy BO to populate with your enum contents and then use the BO to populate the combobox. Or you could define your enum with numbers and text, something like "01 - January", "02 - February" and so on.

Public Enum MyEnum As Integer
    <MicroFour.StrataFrame.Tools.EnumDisplayValue("01 - January", False)> _
    Item1 = 1
    <MicroFour.StrataFrame.Tools.EnumDisplayValue("02 - February", False)> _
    Item2 = 2
    <MicroFour.StrataFrame.Tools.EnumDisplayValue("03 - March", False)> _
    Item3 = 3
End Enum
By Marcia G Akins - 2/22/2012

Hi Ivan.

Thanks. That is what I have already done Smile

Marcia
By Ivan George Borges - 2/22/2012

You're welcome Marcia. Glad you got it working. Cool