how to align numerical cells of a ListIcon to the right?

Just starting out? Need help? Post your questions and find answers here.
morosh
Enthusiast
Enthusiast
Posts: 329
Joined: Wed Aug 03, 2011 4:52 am
Location: Beirut, Lebanon

how to align numerical cells of a ListIcon to the right?

Post by morosh »

Hello:
In a ListIcon gadget, I prefer that cells containing numerical values, are aligned to the right.
is this possible??

thank you
PureBasic: Surprisingly simple, diabolically powerful
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: how to align numerical cells of a ListIcon to the right?

Post by IdeasVacuum »

If on Windows, you could use gonzal's PureLVSORT lib (which has many excellent functions):

Code: Select all

PureLVSORT_SetColumnAlignment(#MyListIconGadget,NumberColumn,#PureLVSORT_Right)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: how to align numerical cells of a ListIcon to the right?

Post by Paul »

This is also available in the PureVision package using the included PV_Gadgets library...
The command is PVGadgets_JustifyListIconColumn()

This of course is a wrapper for Windows API ...

Code: Select all

ProcedureDLL.l JustifyListIconColumn(GadgetID.l,column.l,flag.l)    ;Justify ListIcon Column 0-Left 1-Right 2-Center
  lvc.LV_COLUMN
  lvc\Mask = #LVCF_FMT 
  Select flag
    Case 1
      lvc\fmt=#LVCFMT_RIGHT
    Case 2
      lvc\fmt=#LVCFMT_CENTER
    Default
      lvc\fmt=#LVCFMT_LEFT
  EndSelect
  ProcedureReturn SendMessage_(GadgetID(GadgetID),#LVM_SETCOLUMN,column,@lvc)
EndProcedure
Image Image
morosh
Enthusiast
Enthusiast
Posts: 329
Joined: Wed Aug 03, 2011 4:52 am
Location: Beirut, Lebanon

Re: how to align numerical cells of a ListIcon to the right?

Post by morosh »

Thank you; both
PureBasic: Surprisingly simple, diabolically powerful
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: how to align numerical cells of a ListIcon to the right?

Post by netmaestro »

Thanks Paul, I didn't know this listview message before.
BERESHEIT
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: how to align numerical cells of a ListIcon to the right?

Post by Shardik »

For a cross-platform solution (Windows and Linux) take a look
into this code example:
http://www.purebasic.fr/english/viewtop ... 31&start=3
Post Reply