Ok, I use Listbox-Functions on it and works
CallBack Function PropList_Callback()
Local lastItem As Long
Select Case CBMSG
Case %WM_COMMAND
Control Get User CBHNDL, CBCTL, %UserPropSelect To lastItem
If lastItem Then
Local pItem As PROPERTYITEM At PropertyList_ItemGetPtr(CBHNDL, CBCTL, lastItem)
' Control Set Text CBHNDL,%PropTxtInfo, pItem.propName + $CRLF + pItem.curValue
EndIf
LISTBOX Get Selected CBHNDL, CBCTL To lastItem
Control Set User CBHNDL, CBCTL, %UserPropSelect, lastItem
End Select
End Function
Couldn't there be another kind of PropertyRoot-Items-"Extended" that have some User-Values so one could store some Type & UDT_ElementOffset?
For example I have some UDT
Type t_Control
X as Long
Y as Long
Width as Long
Height as Long
'...
End Type
Dim myControl(123) as t_Control
Fill_PropertyList(Varptr(myControl(7))
Sub Fill_PropertyList(Byval pControl As Dword)
Local pItem As PROPERTYITEM_EX
Local pRoot as Dword
'...
pItem.propName = "Width"
pItem.nItemType = %PIT_EDNUM
pItem.subtype = %PITS_NULL
pItem.sOwner = ""
pItem.cmbItems = ""
pItem.User1 = UDT_ElementOffset(myControl(1).Width)
pItem.User2 = %TypeIs_LONG ' might just contain enumeration as used for Types in thinBasic_VariableGetInfoEx...
' just to know what to peek later...
' #####so here would be a few "Select Case"s needed later ######
pItem.curValue = Str$( Peek(pItem.User2, pControl + pItem.User1 ) )
PropertyRoot_ItemExAdd pRoot, VarPtr(pItem)
'...
Control Set User hPropWindow, %PropList, %UserPropVarPtr, pControl
End Sub
The '%TypeIs_...' usage here just replaces a few "Select Case" - For Strings/Fonts the nItemType would tell. But it won't help differ floats from integers.
The intention is to connect the items directly to some UDT - especially in the reverse function when changed data shall be set to be used - even on different types - so the whole construct is multiple useable.
Also would be great if pItem.cmbItems would accept equates - maybe pItem.subtype could help to classify if uses Strings (default) or Equates. I imagine that way:
pItem.cmbItems = "%TRUE|%FALSE|"
pItem.subtype = %PITS_CMBEQUATES
pItem.curValue = Str$( Peek(pItem.User2, somewhere) )
' some "TypeIs"-Equates to build aliases for simple vartypes on the fly would be cool...
and property-item in list shows either "%TRUE" or "%FALSE"...perhaps can omit "%"
-reverse operation can be done using thinBasic_VariableGetInfoEx...
Bookmarks