Hallo zusammen
Hier eine kleine
Anregung zur Nutzung vom IdleHandler - vielleicht hilfts ja jemandem.
Habe eben darüber nachgedacht, wie ich am besten eine Liste mit Positionen und einer Totalzeile in einer View anzeige, wobei die Anzahl Spalten sowie die Anzahl Positionen erst zur Laufzeit bekannt sind. So bin ich bei 2 Grids gelandet, welche durch eigene Prozeduren zuerst vorbereitet (Anz. Spalten) und dann gefüllt werden (DoFillGrid). Blieb die Problematik der zu synchronisierenden Spaltenbreiten - ein ideales Feld für den IdleHandler!
Hier der Code zur Synchonisierung:
Code:
Use dfallent.pkg
Use Windows.pkg
Deferred_View Activate_oGridsNIdle for ;
Object oGridsNIdle is a dbView
Set Border_Style to Border_Thick
Set Size to 101 384
Set Location to 3 2
Set Maximize_Icon to True
Set Label to "Grids'n'Idles"
Set Verify_Data_Loss_Msg to 0
Set Verify_Exit_Msg to 0
Object oPosGrid is a Grid
Set Location to 5 5
Set Size to 70 377
Set peAnchors to anAll
Set Line_Width to 3 0 // size and Line_width MUST be set before any column properties
Set Form_Width 0 to 47
Set Header_Label 0 to "Column 1"
Set Form_Width 1 to 47
Set Header_Label 1 to "Column 2"
Set Form_Width 2 to 47
Set Header_Label 2 to "Column 3"
End_Object
Object oTotalGrid is a Grid
Set Location to 83 5
Set Size to 12 377
Set Header_Visible_State to False
Set Highlight_Row_State to True
Set peAnchors to anBottomLeftRight
Set Line_Width to 3 0 // size and Line_width MUST be set before any column properties
Set Form_Width 0 to 47
Set Header_Label 0 to ""
Set Form_Width 1 to 47
Set Header_Label 1 to ""
Set Form_Width 2 to 47
Set Header_Label 2 to ""
Object oIdleHandler is a cIdleHandler
Procedure OnIdle
Delegate Send pCheckColumns
End_Procedure
End_Object
Procedure pCheckColumns
Integer i iWidth1 iWidth2
For i from 0 to 2
Get Form_Width of oPosGrid i to iWidth1
Get Form_Width of oTotalGrid i to iWidth2
If (iWidth1 <> iWidth2) Begin
Set Form_Width of oTotalGrid i to iWidth1
End
Loop
End_Procedure
Procedure Activating Returns Integer
Forward Send Activating
Set pbEnabled of oIdleHandler to True
End_Procedure
Procedure Deactivating Returns Integer
Set pbEnabled of oIdleHandler to False
Forward Send DeActivating
End_Procedure
End_Object
Cd_End_Object
Viele Grüsse
Mika Vainio