// **************************************************************************** // // ** ** // // ** Class : cGridColumn ** // // ** ** // // ** Purpose : This class is used to define columns for a the cGrid class. ** // // ** ** // // ** Author : Ulbe Stellema ** // // ** Data Access Europe ** // // ** ** // // ** Date : januari 25, 2002 ** // // ** ** // // **************************************************************************** // Use cGrid.h Class cGridColumn Is A Message // Procedure : Construct_Object // Purpose : Object constructor Procedure Construct_Object Forward Send Construct_Object // Property Integer peWrapStyle wsWrap Property Integer peAlignment alLeft // Column properties Property Boolean pbResize True //Property Integer pbLocked False Property Integer piWidth 0 Property Integer piData 0 // Header properties Property String psHeaderLabel "" Property String psHeaderBitmap "" Property Integer peHeaderLabelAlignment alLeft Property Integer peHeaderBitmapAlignment alLeft Property Integer piHeaderImage -1 Set Focus_Mode To NonFocusable End_Procedure // Construct_Object // Procedure : End_Construct_Object // Purpose : End object constructor Procedure End_Construct_Object Handle hoObject Forward Send End_Construct_Object // Register item in collection (parent should be a cGrid) Move Self To hoObject Delegate Send Private.RegisterItem hoObject End_Procedure // End_Construct_Object // Procedure : Destroy_Object // Purpose : Object destructor Procedure Destroy_Object Handle hoObject Integer iIndex Move Self To hoObject If (hoObject <> 0) Begin // Delete header column //Get IndexFromObject hoObject To iIndex Send Private.DeleteHeaderColumn iIndex // Unregister object Delegate Send Private.UnregisterItem hoObject End // If (hoObject <> 0) Begin Forward Send Destroy_Object End_Procedure // Destroy_Object // Procedure : Private.InsertHeaderColumn // Purpose : Inserts a column in the Header control Procedure Private.InsertHeaderColumn Integer iPos String sItem sLabel sBitmap Integer iResult iMask iFormat Handle hWindow hBitmap // Get the window handle of the header control Move (Window_Handle(phoHeader(Self))) To hWindow ZeroType HDITEM To sItem // Handle label If (psHeaderLabel(Self) <> "") Move (psHeaderLabel(Self)) To sLabel // Handle bitmap If (psHeaderBitmap(Self) <> "") Begin Move (psHeaderBitmap(Self)) To sBitmap Move (LoadImage(0,sBitmap,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)) To hBitmap End // If (psHeaderBitmap(Self) <> "") Begin // Format flags If (peHeaderLabelAlignment(Self) = alLeft) Move (iFormat iOr HDF_LEFT) To iFormat If (peHeaderLabelAlignment(Self) = alRight) Move (iFormat iOr HDF_RIGHT) To iFormat If (peHeaderLabelAlignment(Self) = alCenter) Move (iFormat iOr HDF_CENTER) To iFormat If (sBitmap <> "") Move (iFormat iOr HDF_BITMAP) To iFormat If (sLabel <> "") Move (iFormat iOr HDF_STRING) To iFormat If (peHeaderBitmapAlignment(Self) = alRight) Move (iFormat iOr HDF_BITMAP_ON_RIGHT) To iFormat If (piHeaderImage(Self) <> -1) Move (iFormat iOr HDF_IMAGE) To iFormat // Windows XP //If (peHeaderSortBitmap(Self) = bmSortDown) Move (iFormat iOr HDF_SORTDOWN) To iFormat //If (peHeaderSortBitmap(Self) = bmSortUp) Move (iFormat iOr HDF_SORTUP) To iFormat // Mask flags Move (HDI_LPARAM iOr HDI_FORMAT) To iMask If (psHeaderBitmap(Self) <> "") Move (iMask Ior HDI_BITMAP) To iMask If (piHeaderImage(Self) <> -1) Move (iMask Ior HDI_IMAGE) To iMask If (psHeaderLabel(Self) <> "") Move (iMask Ior HDI_TEXT) To iMask If (piWidth(Self) <> 0) Move (iMask iOr HDI_WIDTH) To iMask Put iMask To sItem at HDITEM.mask Put (piWidth(Self)) To sItem at HDITEM.cxy Put (AddressOf(sLabel)) To sItem at HDITEM.pszText Put hBitmap To sItem at HDITEM.hbm Put (Length(sLabel)) To sItem at HDITEM.cchTextMax Put iFormat To sItem at HDITEM.fmt Put Self To sItem at HDITEM.lParam Put (piHeaderImage(Self)) To sItem at HDITEM.iImage Move (SendMessage(hWindow,HDM_INSERTITEMA,9999,AddressOf(sItem))) To iResult End_Procedure // Private.InsertHeaderColumn // Procedure : Private.DeleteHeaderColumn // Purpose : Deletes a column in the Header control Procedure Private.DeleteHeaderColumn Integer iPos Integer iResult Handle hWindow If (Object_Id(phoHeader(Self))) ; Move (Window_Handle(phoHeader(Self))) To hWindow If hWindow Move (SendMessage(hWindow,HDM_DELETEITEM,iPos,0)) To iResult End_Procedure // Private.DeleteHeaderColumn End_Class // cGridColumn