How to solve class related code issues possible in VO but not in .Net?
Posted: Wed May 06, 2020 5:49 pm
Hi Dick,
why don't use a extension method for this?
This is code from my own class library:
Wolfgang
why don't use a extension method for this?
This is code from my own class library:
Code: Select all
static class XsharpCompatibility
static method AutoSize( self oListViewColumn as ListViewColumn ) as void
local nIndex as int
local nWidth as int
local oOwner as ListView
oOwner := oListViewColumn:Owner
if oOwner != NULL_OBJECT
nIndex := int( oOwner:__GetColumnIndexFromSymbol( oListViewColumn:NameSym ) ) - 1
ListView_SetColumnWidth( oOwner:handle(), int(nIndex), shortint( _cast, LVSCW_AUTOSIZE ) )
nWidth := ListView_GetColumnWidth( oOwner:Handle(), nIndex )
ListView_SetColumnWidth( oOwner:handle(), int(nIndex), shortint( _cast, LVSCW_AUTOSIZE_USEHEADER ) )
if nWidth > ListView_GetColumnWidth( oOwner:Handle(), nIndex )
ListView_SetColumnWidth( oOwner:handle(), nIndex, shortint( _cast, LVSCW_AUTOSIZE ) )
endif
endif
return
static method GetPixelWidth( self oListViewColumn as ListViewColumn ) as int
local dwIndex as dword
local nPixelWidth as int
local oOwner as ListView
oOwner := oListViewColumn:Owner
if oOwner != NULL_OBJECT
dwIndex := oOwner:__GetColumnIndexFromSymbol(oListViewColumn:NameSym) - 1
nPixelWidth := ListView_GetColumnWidth(oOwner:Handle(), int(_cast, dwIndex))
else
nPixelWidth := 0
endif
return nPixelWidth
static method SetPixelWidth( self oListViewColumn as ListViewColumn, nNewWidth as int ) as void
local dwIndex as dword
local oOwner as ListView
oOwner := oListViewColumn:Owner
if (oOwner != NULL_OBJECT) .and. (oOwner:CurrentView == #ReportView)
if (nNewWidth > 0)
dwIndex := oOwner:__GetColumnIndexFromSymbol(oListViewColumn:NameSym) - 1
ListView_SetColumnWidth(oOwner:Handle(), int(_cast, dwIndex), nNewWidth)
endif
endif
return
end class