Jump to content

Keep number format in sorted ListView, stringformat on sort


Skysnake
 Share

Recommended Posts

I am tracking this topic by @LarsJ.  It is very advanced and overkill for what I am currently trying to do.

 

Problem is this.

Listview contains columns, one of which is right aligned and gets populated by float values, such as 123.99.  Some do not have decimals ie 124.00 and on sort gets truncated to 124.  Its obviously still the same value, but the display has reset.

; line below is for list VIEW
    ;..................................0.........1......2............
    $cListView = GUICtrlCreateListView("CUSTOMER|AMOUNT|DESCRIPTION", 8, 152, 764, 279)
    GUICtrlSetBkColor($cListView, $GUI_BKCOLOR_LV_ALTERNATE) ; alternate between the listview background color and the listview item background color
    GUICtrlSetBkColor($cListView, $LVStdClr) ; Set the background color for the listview

    _GUICtrlListView_SetColumnWidth($cListView, 0, 120) ; -- the client name
    _GUICtrlListView_SetColumnWidth($cListView, 1, 90) ;-- the amount
    _GUICtrlListView_JustifyColumn($cListView, 1, 1) ;  1 - Text is right aligned
    _GUICtrlListView_SetColumnWidth($cListView, 2, 200) ; the description

What I am looking for is something native and simple like a 

    _GUICtrlListView_SetColumnFormat($cListView, 1, "%.2f") ;  1 - column is stringformatted to "%.2f"

So that after each sort it will appear as it was in the original rendering.

Is there something like this? I have not been able to find a simple solution.

:)

Thanks.

Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...