From 8f76593828554975d0dd53800374a5ceae205b57 Mon Sep 17 00:00:00 2001 From: lazarus Date: Wed, 23 Oct 2002 14:36:53 +0000 Subject: [PATCH] AJ:Fixes to PromptUser;Switched ShowMessage* to use NotifyUser*; fixed TGraphicPropertyEditor for when Property is nil. git-svn-id: trunk@3542 - --- lcl/include/messagedialogs.inc | 10 ++++++--- lcl/interfaces/gnome/gnomewinapi.inc | 31 ++++++++++++++------------- lcl/interfaces/gnome/gnomewinapih.inc | 8 +++++-- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/lcl/include/messagedialogs.inc b/lcl/include/messagedialogs.inc index 970d61a685..61a8afeb39 100644 --- a/lcl/include/messagedialogs.inc +++ b/lcl/include/messagedialogs.inc @@ -492,17 +492,17 @@ end; procedure ShowMessage(const aMsg: string); begin - MessageDlg (aMsg, mtInformation, [mbOK], 0); + NotifyUser(aMsg, idDialogInfo); end; procedure ShowMessageFmt(const aMsg: string; Params: array of const); begin - MessageDlg (Format (aMsg, Params), mtInformation, [mbOK], 0); + NotifyUser(Format(aMsg, Params), idDialogInfo); end; procedure ShowMessagePos(const aMsg: string; X, Y: Integer); begin - MessageDlgPos(aMsg, mtInformation, [mbOK], 0, X, Y); + NotifyUserAtXY(aMsg, idDialogInfo, X, Y); end; //----------------------------------------------------------------------------// @@ -532,6 +532,10 @@ end; { $Log$ + Revision 1.17 2002/10/23 14:36:52 lazarus + AJ:Fixes to PromptUser;Switched ShowMessage* to use NotifyUser*; + fixed TGraphicPropertyEditor for when Property is nil. + Revision 1.16 2002/10/11 16:00:39 lazarus AJ: made InputQuery Interface Dependant diff --git a/lcl/interfaces/gnome/gnomewinapi.inc b/lcl/interfaces/gnome/gnomewinapi.inc index 0d7c90ceba..cb2776f4b6 100644 --- a/lcl/interfaces/gnome/gnomewinapi.inc +++ b/lcl/interfaces/gnome/gnomewinapi.inc @@ -71,7 +71,7 @@ end; or other information, or to ask questions. ------------------------------------------------------------------------------} Function PromptUserWidget(const DialogCaption, DialogMessage : String; - DialogType : longint; Buttons : Array of Longint; DefaultIndex : Longint) : Pointer; + DialogType : longint; Buttons : PLongint; ButtonCount, DefaultIndex : Longint) : Pointer; var BoxType : PChar; MainWidget : Pointer; @@ -107,8 +107,8 @@ begin MsgTitle := nil; BTNArray := nil; - ReallocMem(BTNArray, SizeOf(PgChar)*(High(Buttons) - Low(Buttons) + 2)); - For I := Low(Buttons) to High(Buttons) do begin + ReallocMem(BTNArray, SizeOf(PgChar)*(ButtonCount + 1)); + For I := 0 to ButtonCount - 1 do begin Case Buttons[I] Of idButtonOk : StockName := GNOME_STOCK_BUTTON_OK; idButtonCancel : StockName := GNOME_STOCK_BUTTON_CANCEL; @@ -125,11 +125,9 @@ begin else StockName := ''; end; - BTNArray[I - Low(Buttons)] := StockName; - If DefaultIndex = I then - DefaultIndex := I - Low(Buttons); + BTNArray[I] := StockName; end; - BTNArray[High(Buttons) - Low(Buttons) + 1] := nil; + BTNArray[ButtonCount] := nil; TXTLayout := gnome_icon_layout_text(PGDIObject(GetStockObject(SYSTEM_FONT))^.GDIFontObject, PgChar(DialogMessage), ' ', Screen.Width div 3, False); @@ -150,8 +148,7 @@ begin Result := gnome_message_box_newv(PgChar(NewMessage), BoxType, BTNArray); - If (DefaultIndex >= High(Buttons) - Low(Buttons)) or - (DefaultIndex < 0) + If (DefaultIndex >= ButtonCount) or (DefaultIndex < 0) then DefaultIndex := 0; @@ -168,18 +165,18 @@ begin end; Function TGnomeObject.PromptUser(const DialogCaption, DialogMessage : String; - DialogType : longint; Buttons : Array of Longint; + DialogType : longint; Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint; var MsgBox : Pointer; MSGResult : Longint; begin - MsgBox := PromptUserWidget(DialogCaption, DialogMessage, DialogType, Buttons, DefaultIndex); + MsgBox := PromptUserWidget(DialogCaption, DialogMessage, DialogType, Buttons, ButtonCount, DefaultIndex); MSGResult := gnome_dialog_run_and_close(MsgBox); Case MSGResult of -1 : Result := EscapeResult; else - Result := Buttons[MSGResult + Low(Buttons)] + Result := Buttons[MSGResult] end; end; @@ -201,19 +198,19 @@ end; questions. ------------------------------------------------------------------------------} Function TGnomeObject.PromptUserAtXY(const DialogCaption, DialogMessage : String; - DialogType : longint; Buttons : Array of Longint; DefaultIndex, EscapeResult : Longint; + DialogType : longint; Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint; X, Y : Longint) : Longint; var MsgBox : Pointer; MSGResult : Longint; begin - MsgBox := PromptUserWidget(DialogCaption, DialogMessage, DialogType, Buttons, DefaultIndex); + MsgBox := PromptUserWidget(DialogCaption, DialogMessage, DialogType, Buttons, ButtonCount, DefaultIndex); gtk_widget_set_uposition(MsgBox, X, Y); MSGResult := gnome_dialog_run_and_close(MsgBox); Case MSGResult of -1 : Result := EscapeResult; else - Result := Buttons[MSGResult + Low(Buttons)] + Result := Buttons[MSGResult] end; end; @@ -296,6 +293,10 @@ end; { $Log$ + Revision 1.10 2002/10/23 14:36:53 lazarus + AJ:Fixes to PromptUser;Switched ShowMessage* to use NotifyUser*; + fixed TGraphicPropertyEditor for when Property is nil. + Revision 1.9 2002/10/21 03:23:34 lazarus AJ: rearranged GTK init stuff for proper GNOME init & less duplication between interfaces diff --git a/lcl/interfaces/gnome/gnomewinapih.inc b/lcl/interfaces/gnome/gnomewinapih.inc index 16651edb7c..e8858a7e5a 100644 --- a/lcl/interfaces/gnome/gnomewinapih.inc +++ b/lcl/interfaces/gnome/gnomewinapih.inc @@ -19,9 +19,9 @@ } Function PromptUser(const DialogCaption, DialogMessage : String; DialogType : longint; - Buttons : Array of Longint; DefaultIndex, EscapeResult : Longint) : Longint; override; + Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint) : Longint; override; Function PromptUserAtXY(const DialogCaption, DialogMessage : String; DialogType : longint; - Buttons : Array of Longint; DefaultIndex, EscapeResult : Longint; X, Y : Longint) : Longint; override; + Buttons : PLongint; ButtonCount, DefaultIndex, EscapeResult : Longint; X, Y : Longint) : Longint; override; Function LoadStockPixmap(StockID: longint) : HBitmap; override; @@ -29,6 +29,10 @@ Function RequestInput(const InputCaption, InputPrompt : String; MaskInput : Bool { $Log$ + Revision 1.8 2002/10/23 14:36:53 lazarus + AJ:Fixes to PromptUser;Switched ShowMessage* to use NotifyUser*; + fixed TGraphicPropertyEditor for when Property is nil. + Revision 1.7 2002/10/21 03:23:35 lazarus AJ: rearranged GTK init stuff for proper GNOME init & less duplication between interfaces