PDA

View Full Version : Positionen & Totale in 2 Tabellen mit gleichen Spaltenbreiten



GhostShotIV
24-Feb-2011, 10:16 AM
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:

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
Vom: 24.08.2009 um 10:24

Ditte
24-Feb-2011, 10:46 AM
Hallo Mika,

Danke für Deine Beiträge.
Leider kann ich mich zur Zeit nicht mit dem neuem DBGrid beschäftigen. Ich komme aber später bestimmt darauf zurück.
Ich will auch nicht, dass Du so ins Leere strampelst.
Siehst ja auch, dass Viele reinschauen

GhostShotIV
24-Feb-2011, 04:11 PM
Hallo Dittmar,

danke für die Blumen, aber ich bin nicht Mika =)

Das oben war nur ein Repost aus dem alten Forum. Ich schau mal, das ich noch einige Threads aus dem Google Cache rette, bevor auch die im Nirwana verschwinden.