Needs more work to do
Adapt it for your needs
Tested with PB 4.6 x86 - x64 & Win 7 x64
Code: Select all
Global *OldProc,PaintFlag,LineSpace,CB,SI
FontSize = 14
UsedFont = LoadFont(0,"Tahoma",FontSize)
LoadFont(1,"Tahoma",FontSize - 3)
hdc = GetDC_(0)
SelectObject_(hdc, UsedFont)
GetTextMetrics_(hdc, @tm.TEXTMETRIC)
LineSpace = tm\tmheight + 2
CreateImage(0,250,1000)
StartDrawing(ImageOutput(0))
Box(0,0,250,1000,$E6FEFE)
Box(0,0,22,1000,$A1A1A3)
For i=LineSpace+1 To 1000
Line(0,i,250,1,$A1A1A3)
i + LineSpace
Next
StopDrawing()
CreateImage(1,250,800)
StartDrawing(ImageOutput(1))
Box(0,0,250,800,$F3FEFE)
For i=LineSpace+1 To 800
Line(0,i,250,1,$A1A1A3)
i + LineSpace
Next
StopDrawing()
Procedure TreeGadgetSC(hWnd.l,uMsg.l,wParam.l,lParam.l)
Select uMsg
Case #WM_PAINT
If PaintFlag = 0
PaintFlag = 1
BeginPaint_(hWnd,p.PAINTSTRUCT)
hDC = GetDC_(hWnd)
hbmTemp = CreateCompatibleBitmap_(hDC,250,800)
hdcMem = CreateCompatibleDC_(hDC)
hbmOld = SelectObject_(hdcMem,hbmTemp)
SendMessage_(hWnd,#WM_PAINT,hdcMem,0)
If hWnd = GadgetID(1)
hBrushBack = CreatePatternBrush_(ImageID(0))
ElseIf hWnd = GadgetID(2)
hBrushBack = CreatePatternBrush_(ImageID(1))
EndIf
hBrushOld = SelectObject_(hDC,hBrushBack)
SetRect_(trc.RECT,0,0,250,800)
FillRect_(hDC,trc,hBrushBack)
SelectObject_(hDC,hBrushOld)
DeleteObject_(hBrushBack)
TransparentBlt_(hDC,0,0,250,800,hdcMem,0,0,250,800,GetSysColor_(#COLOR_WINDOW))
SelectObject_(hdcMem,hbmOld)
DeleteObject_(hbmTemp)
DeleteDC_(hdcMem)
ReleaseDC_(hWnd,hDC)
EndPaint_(hWnd,p)
PaintFlag = 0
ProcedureReturn 0
Else
ProcedureReturn CallWindowProc_(*OldProc,hWnd,uMsg,wParam,lParam)
EndIf
Case #WM_LBUTTONDOWN
t.TV_HITTESTINFO
GetCursorPos_(@t\pt)
ScreenToClient_(hWnd,@t\pt)
SendMessage_(hWnd,#TVM_HITTEST,0,t)
SendMessage_(hWnd,#TVM_SELECTITEM,#TVGN_CARET,t\hItem)
r.RECT\left=t\hItem
If GetGadgetItemAttribute(1,GetGadgetState(1),#PB_Tree_SubLevel) <> 0
SendMessage_(hwnd,#TVM_GETITEMRECT,0,@r)
If hWnd = GadgetID(1)
HideWindow(1,1)
ResizeGadget(CB,r\left+255,r\top+2,200,LineSpace)
Else
ResizeGadget(CB,0,0,0,0)
HideWindow(1,0)
EndIf
Else
ResizeGadget(CB,0,0,0,0)
HideWindow(1,0)
EndIf
Case #WM_LBUTTONUP
SetGadgetState(2,-1)
Case #WM_ERASEBKGND
ProcedureReturn #True
Case #WM_VSCROLL, #WM_MOUSEWHEEL
InvalidateRect_(hWnd,0,1)
ProcedureReturn CallWindowProc_(*OldProc,hWnd,uMsg,wParam,lParam)
Case #WM_DESTROY
SetWindowLongPtr_(hWnd,#GWL_WNDPROC,*OldProc);
ProcedureReturn CallWindowProc_(*OldProc,hWnd,uMsg,wParam,lParam)
;
Default;
ProcedureReturn CallWindowProc_(*OldProc,hWnd,uMsg,wParam,lParam)
EndSelect
EndProcedure
OpenWindow(0,0,0,500,600,"Property Box",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ScrollAreaGadget(0, 10, 10, 480,580, 455, 800, 10,#PB_ScrollArea_BorderLess)
CB = ComboBoxGadget(#PB_Any,0,0,0,0 ,#PB_ComboBox_Editable)
SetGadgetFont(CB, FontID(1))
For a = 1 To 5
AddGadgetItem(CB, -1,"ComboBox item " + Str(a))
Next
TreeGadget(1,0,0,255,1000)
SetWindowTheme_(GadgetID(1), @null.w, @null.w)
SetGadgetFont(1, FontID(0))
For j = 1 To 30 Step 5
AddGadgetItem(1,-1,"Untitled Item #" + Str(j),0,0)
For i=1 To 4
AddGadgetItem(1,-1,"Untitled Item #" + Str(i),0,1)
Next
Next
TreeGadget(2,235,0,250,1000,#PB_Tree_NoLines)
SetWindowTheme_(GadgetID(2), @null.w, @null.w)
SetGadgetFont(2, FontID(0))
SetGadgetColor(2,#PB_Gadget_FrontColor,$101BFD)
SetWindowLongPtr_(GadgetID(2), #GWL_STYLE, GetWindowLongPtr_(GadgetID(2), #GWL_STYLE) | #WS_CLIPSIBLINGS)
SetWindowPos_(GadgetID(2), #HWND_BOTTOM, -1, -1, -1, -1, #SWP_NOSIZE | #SWP_NOMOVE)
For j = 1 To 30 Step 5
AddGadgetItem(2,-1,"Required Item #" + Str(j),0,0)
For i=1 To 4
AddGadgetItem(2,-1,"Choosen Item #" + Str(i),0,1)
Next
Next
CloseGadgetList()
OpenWindow(1,270,5,200,580,"",#PB_Window_BorderLess)
SetParent_(WindowID(1),WindowID(0))
*OldProc = SetWindowLongPtr_(GadgetID(1),#GWL_WNDPROC,@TreeGadgetSC())
*OldProc = SetWindowLongPtr_(GadgetID(2),#GWL_WNDPROC,@TreeGadgetSC())
Repeat
If GetActiveWindow() = 1
SetActiveWindow(0)
EndIf
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 1
SI = GetGadgetState(1)
SetGadgetItemState(2, SI,GetGadgetItemState(1,SI))
;
Case CB
If GetGadgetItemAttribute(1,GetGadgetState(1),#PB_Tree_SubLevel) <> 0
If GetGadgetText(CB) <> ""
SetGadgetItemText(2, SI , GetGadgetText(CB))
EndIf
ResizeGadget(CB,0,0,0,0)
SetGadgetText(CB,"")
EndIf
;
EndSelect
EndSelect
Until Quit = 1
Edit 2 : Updated