Autor Beitrag
hube
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

WIN XP
D7 Prof
BeitragVerfasst: Mo 13.03.06 09:34 
Hallo zusammen

Wie kann ich bei einem MessageDlg wie:

MessageDlg('Wollen Sie die Daten wirklich überschreiben?',
mtWarning,[mbYes,mbNo],0);

machen, dass NICHT der "Yes" Knopf sondern der "No" Knopf den Focus hat?

Besten Dank für Euere Hilfe

hube
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Mo 13.03.06 10:04 
Ich denke, da muß du dir ein eigenes Fenster bauen, bei dem du den Focus bestimmen kannst.
Ich stand mal vor dem selben Problem und habe den MessageDlg nachgebaut.
Man bekommt sehr viele Informationen aus der Unit wo der MessageDlg drin steckt.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 13.03.06 11:07 
Hallo,
was hälst Du davon? :angel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if MessageDlg('Vorhandene Daten werden überschrieben!', 
              mtWarning,
              [mbNo,mbOk],0) = mrOk then
  //Daten überschreiben;


//Edit: oder das: Voreinstellung (Button-Fokusierung) bei MessageBox, MessageDlg

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
aim65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Mo 13.03.06 16:50 
Probier mal so was:
ausblenden Delphi-Quelltext
1:
2:
rply := Application.MessageBox(Pchar(text5),'Exit Program',
                           mb_IconQuestion + mb_YesNoCancel + mb_DefButton3);

Hab ich irgendwo gelesen, funktioniert bei mir prima. Oben steht dann der Focus auf "Cancel/Abbrechen", d.h. der dritte Button. Weiß allerdings nicht, ob das auch für den Dialog gilt :roll:
hube Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

WIN XP
D7 Prof
BeitragVerfasst: Mo 13.03.06 20:33 
Hallo zusammen

Mein Problem ist gelöst. Ich verwende nun die Lösung wie sie Lannes im "Edit" vorgeschlagen hat und es funktioniert wunderbar.

Besten Dank an alle für die Hilfe.

hube