Autor Beitrag
mexx
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 10:59 
Hallo,

mein Grid erhält die Daten von einer Query. Die Query besitzt die Fields. Zu jedem Field kann man ein DisplayFormat einstellen. Ich möchte einen Wert von Bsp. 10.20 als 10.20 min. angezeigt bekommen.

So wie ich die Hilfe verstanden habe müsste meine Einstellung wiefolgt aussehen.

00.00 'min.'

Jedoch funktioniert es nicht. Woran liegt es?
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 14.03.06 11:06 
Titel: Re: DisplayFormat in Fields
user profile iconmexx hat folgendes geschrieben:
Jedoch funktioniert es nicht.

Und was passiert statt dessen?
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 11:12 
Nix! Das Feld wird nicht verändert. Der Wert bleibt wie er ist.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 14.03.06 11:19 
Probier mal hh.hh 'min.'
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 11:26 
Ich kann eintragen, was ich will, keine Reaktion. Nicht mal eine Fehlermeldung wenn ich falsche Eingabe mache.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 14.03.06 11:32 
Bei mir funktioniert das. Ist dein Grid ein DBGrid oder ein StringGrid?
Hast du schonmal andere Felder der Query versucht zu formatieren? Falls ja, wie funtkioniert das da? Handelt es such denn bei deinem Feld um ein "Zeit"-Feld?
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 11:43 
Es handelt sich hierbei um ein DBGrid. Das darzustellende Feld ist in der DB ein DOUBLE PRECISION. Als FieldFind der Fields im Delphi ist es als fkData eingestellt. Die Informationen werden auch korrekt angezeigt. Ansich will ich hinter dem Wert nur ein min. stehen haben. Wie verhält sich dan dieser Wert, wenn ich Ihn auslesen will. Ist das min. nur optisch oder auch Teil des Zelleninhaltes?
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 14.03.06 12:02 
das 'min' ist nicht Teil des Inhalts.
Ich habe bei mir noch ein bisschen experimentiert. Auch bei numerischen Feldern funktioniert das problemlos. Ich kann dein Problem nicht nachvollziehen.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 12:56 
Ich habe bei Feld noch ein GetText und SetText-Ereignis definiert, welches den Wert von einem Tag in einen Minutenwert umrechnet. Vielleicht liegt es daran?
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 14.03.06 13:07 
GetText und SetText habe ich noch nie verwendet. Probiere es doch einfach aus und nimm das mal aus deinem Source raus.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Di 14.03.06 13:11 
Dann macht er es. Aber mit 00,00 'min.'
Ärgerlich, da muss ich mal schauen, wie ich das löse. Zumindest weis ich jetzt, dass meine Eingabe korrekt war.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 14.03.06 13:15 
Also bei mir funktioniert das bei TFloatfields nicht. Alternativ kannst Du die OnGetText/OnSetText-Events überschreiben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
TMyDatamodule.MyfieldGetText (Sender: TField; var Text: String; DisplayText: Boolean);
begin
  Text := FormatDateTime ('hh:nn "min"',Sender.Asfloat);
end;

Wenn du das editierst, dann ggf. SetText definierten, damit die eingegebene Zeit wieder zurückkonvertiert wird.

_________________
Na denn, dann. Bis dann, denn.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Mi 15.03.06 15:56 
Danke, das hat funktioniert. Aber nun ist der eingetragene Wert, wenn man Ihn ausliest, mit "min" versehen, aber das könnte man, bevor man es als Parameter weiterverwendet mit copy entfernen.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mi 15.03.06 17:34 
Ich finde die Lösung hier (OnGetText) zum Editieren nicht gut. Ich würde OnEnter / OnExit des Edit-Feldes nehmen.
OnEnter => Zeige editierbaren Text an...
OnExit => Konvertiere den editierten Text in den Text zum anzeigen.

Beispiel: EditFeld = '12:34 min'
Klick auf das Editfeld (OnEnter) ==> '12:34'
Rumeditieren, z.B. '01:56'
Tab (OnExit) ==> '01:56 min'

sieht gut aus, klappt gut.

_________________
Na denn, dann. Bis dann, denn.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 16.03.06 07:48 
Es handelt sich bei meiner Komponente um ein DBGrid. Ich lade die Inhalte über eine Query. Die Query beinhaltet alle Fields, welche das Ergebniss der SQL ist. Bei den Fields gibt es keine Ereignisse OnEnter oder OnExit.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 16.03.06 08:53 
Oh, ein DB-Grid. Oje. Dann weiss ich auch nicht weiter.

Ich nehm das TcxGrid von devExpress. Damit hat man dann keine Probleme mehr...

_________________
Na denn, dann. Bis dann, denn.
mexx Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1183



BeitragVerfasst: Do 16.03.06 08:55 
Besser gesagt ein TwwDBGrid von den IBAccess-Komponenten.