Hi,
Srod hat mir eine Lösung gegeben, wie man eins vom anderen abhängig macht. Man braucht den aktuellsten Code von Esgrid.
Code: Alles auswählen
Code vom Srod:
;Scroll the first grid VERTICALLY and watch the second grid keep pace!
IncludePath "..\Source\"
XIncludeFile "EsGRID.pbi"
IncludePath ""
;Utility function which calculates the vertical offsets between the two grids and scrolls
;the destination grid to match the first one.
Procedure MatchScroll(hWndO, hWndN)
Protected result, topO, topN, diff, rc.RECT, scroll
;///INTERNAL EsGRID STRUCTURE and PROPERTY
Protected *pointer.egridInfoStruc
*pointer = GetProp_(hWndN, @"egrid_ListPointer")
;/////////////////////////////////////////
topO = SendMessage_(hWndO, #LVM_GETTOPINDEX,0,0)
topN = SendMessage_(hWndN, #LVM_GETTOPINDEX,0,0)
diff = topO-topN
If diff
rc\left=#LVIR_BOUNDS
SendMessage_(hWndO, #LVM_GETITEMRECT, 0,rc)
If rc\bottom>rc\top
scroll = diff*(rc\bottom-rc\top)
;///INTERNAL EsGRID FUNCTION
egrid_removeeditgadgets(*pointer)
;///////////////////////////
InvalidateRect_(hWndN,0,0)
SendMessage_(hWndN, #LVM_SCROLL, 0, scroll)
;///INTERNAL EsGRID FUNCTION
egrid_scrolloutvision(*pointer)
;///////////////////////////
EndIf
EndIf
EndProcedure
;Cellcallback function for the first grid.
;This will need changing if the two grids are to match each other exactly with vertical
;scrolling. At the moment the second grid will match the first.
;Attempt to alter this and an infinite loop will ensue!
Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
Protected result = #True
Select uMsg
Case #egrid_NotifyCellType ;We use this message in order to trap multiple-cell selections etc.
MatchScroll(GadgetID(1), GadgetID(2))
EndSelect
ProcedureReturn result
EndProcedure
;///////////////////////////////////////////////////////////////////////////////////////////////////////////////
;Create two grids.
If OpenWindow(0,0,0,640,600,"EsGRID demo - vertical scrolling.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible) And CreateGadgetList(WindowID(0))
egrid_CreateGrid(1, 20, 20, 280, 560,42,0, #egrid_GridLines|#egrid_ResizeColumnsTrue|#egrid_MultiLineText)
egrid_CreateCellCallback(1, @MyCellCallBack())
egrid_SetHeaderHeight(1, 42)
egrid_SetOption(1, #egrid_SelectionBorderWidth, 2)
For b=0 To 19 ;20 columns.
egrid_AddColumn(1,b,"Col " + Str(b),100)
Next
egrid_AddRows(1,-1, 100) ;Add 100 rows.
egrid_CreateGrid(2, 320, 20, 280, 560,42,0, #egrid_GridLines|#egrid_ResizeColumnsTrue|#egrid_MultiLineText)
egrid_SetHeaderHeight(2, 42)
egrid_SetOption(2, #egrid_SelectionBorderWidth, 2)
For b=0 To 19 ;20 columns.
egrid_AddColumn(2,b,"Col " + Str(b),100)
Next
egrid_AddRows(2,-1, 100) ;Add 100 rows.
HideWindow(0,0)
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Gadget
EndSelect
Until EventID = #PB_Event_CloseWindow
EndIf
;///////////////////////////////////////////////////////////////////////////////////////////////////////////////
Achja, der Grund warum ich das ganze brauche:
Ich hatte das ganze bis jetzt in einem Grid -> Scrollt man jedoch horizontal , sieht man nicht mehr die ersten Spalten.
Da die ersten Daten jetzt fix bleiben (horizontal) kann ich mit den zweiten horizontal scrollen.
Es ist im Prinzip wie in Excel, wo man Zeile 1-10 fixieren kann und ab Zeile 11 scrollen.
Es wäre natürlich super und wahrscheinlich einfacher,
wenn man die Breite der 2. Srollbar auf Null setzen könnte oder unsichtbar

...
lg
Marco