Code : Tout sélectionner
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
; Yves ANDRAL 12/04/2016
; Pb 5.42
Enumeration FormWindow
#Window_0
EndEnumeration
Enumeration FormGadget
#ListIcon_0
EndEnumeration
Declare Exit()
Declare OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Declare SetColumnAlignment(gadget, Column, flags)
Declare.a GetColumnAlignment(gadget, Column)
OpenWindow_0()
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#Window_0, x, y, width, height, "Alignement des colonnes", #PB_Window_SystemMenu)
ListIconGadget(#ListIcon_0, 0, 0, 600, 400, "Column 1", 100, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
AddGadgetColumn(#ListIcon_0, 1, "Column 2", 100)
AddGadgetColumn(#ListIcon_0, 2, "Column 3", 100)
AddGadgetColumn(#ListIcon_0, 3, "Colmun 4", 100)
AddGadgetColumn(#ListIcon_0, 4, "Colmun 5", 100)
;on rempli quelques lignes
AddGadgetItem(#ListIcon_0, -1, "Jean" + #LF$ + "3" + #LF$ + "Bières" + #LF$ + "Sandwich" + #LF$ + "15.05")
AddGadgetItem(#ListIcon_0, -1, "Paul" + #LF$ + "2" + #LF$ + "Vin" + #LF$ + "Pomme" + #LF$ + "12.00")
AddGadgetItem(#ListIcon_0, -1, "Michel" + #LF$ + "4" + #LF$ + "Eau" + #LF$ + "Brownie" + #LF$ + "3.55")
AddGadgetItem(#ListIcon_0, -1, "Claude" + #LF$ + "1" + #LF$ + "Eau gazeuse" + #LF$ + "Tartelette" + #LF$ + "6.50")
AddGadgetItem(#ListIcon_0, -1, "Alfred" + #LF$ + "6" + #LF$ + "Jus de fruit" + #LF$ + "Hot dog" + #LF$ + "21.21")
AddGadgetItem(#ListIcon_0, -1, "Vincent" + #LF$ + "5" + #LF$ + "Jus de raisin" + #LF$ + "Frites" + #LF$ + "12.05")
;Procédure à déclencher quand on quitte l'application
BindEvent(#PB_Event_CloseWindow, @Exit())
SetColumnAlignment(#ListIcon_0,1,2)
SetColumnAlignment(#ListIcon_0,4, 1)
For i = 0 To 4
Select GetColumnAlignment(#ListIcon_0, i)
Case 0
Align$ = "Gauche"
Case 1
Align$ = "Droite"
Case 2
Align$ = "Centré"
EndSelect
Debug "Colonne " + i + " : " + Align$
Next
Repeat : WaitWindowEvent() : ForEver
EndProcedure
;
Procedure SetColumnAlignment (gadget, Column, flags); 0-Left(Default), 1-Right, 2-Center
Protected lvc.LV_COLUMN
lvc\Mask = #LVCF_FMT
lvc\fmt = flags
ProcedureReturn SendMessage_(GadgetID(gadget),#LVM_SETCOLUMN,Column,@lvc)
EndProcedure
Procedure.a GetColumnAlignment(gadget, Column)
Protected ListIcon.LV_COLUMN
ListIcon\mask = #LVCF_FMT
SendMessage_(GadgetID(gadget), #LVM_GETCOLUMN, Column, @ListIcon)
ProcedureReturn ListIcon\fmt & (#LVCFMT_CENTER | #LVCFMT_RIGHT | #LVCFMT_LEFT)
EndProcedure
Procedure Exit()
End
EndProcedure