Skip to content

Commit 008147f

Browse files
Fix: text doesn't fit inside MessageBox
The caption can only have limitted length Better to avoid using caption in MessageBox only using the inside text
1 parent f461072 commit 008147f

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

source/code/main.pas

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ TFormTrackerModify = class(TForm)
168168
FControlerGridTorrentData: TControlerGridTorrentData;
169169
function CheckForAnnounce(const TrackerURL: utf8string): boolean;
170170
procedure AppendTrackersToMemoNewTrackers(TrackerList: TStringList);
171-
procedure ShowUserErrorMessage(const ErrorText: string; const FormText: string = '');
171+
procedure ShowUserErrorMessage(ErrorText: string; const FormText: string = '');
172172
function TrackerWithURLAndAnnounce(const TrackerURL: utf8string): boolean;
173173
procedure UpdateTorrent;
174174
procedure ShowHourGlassCursor(HourGlass: boolean);
@@ -538,7 +538,7 @@ function TFormTrackerModify.CheckForAnnounce(const TrackerURL: utf8string): bool
538538
(not WebTorrentTrackerURL(TrackerURL)) and (not FDragAndDropStartUp);
539539
end;
540540

541-
procedure TFormTrackerModify.ShowUserErrorMessage(const ErrorText: string;
541+
procedure TFormTrackerModify.ShowUserErrorMessage(ErrorText: string;
542542
const FormText: string);
543543
begin
544544
if FConsoleMode then
@@ -550,10 +550,9 @@ procedure TFormTrackerModify.ShowUserErrorMessage(const ErrorText: string;
550550
end
551551
else
552552
begin
553-
if FormText = '' then
554-
Application.MessageBox(PChar(@ErrorText[1]), '', MB_ICONERROR)
555-
else
556-
Application.MessageBox(PChar(@ErrorText[1]), PChar(@FormText[1]), MB_ICONERROR);
553+
if FormText <> '' then
554+
ErrorText := FormText + sLineBreak + ErrorText;
555+
Application.MessageBox(PChar(@ErrorText[1]), '', MB_ICONERROR);
557556
end;
558557
end;
559558

@@ -621,7 +620,6 @@ procedure TFormTrackerModify.UpdateTorrent;
621620
Reply, BoxStyle, i, CountTrackers: integer;
622621
PopUpMenuStr: string;
623622
SomeFilesCannotBeWriten, SomeFilesAreReadOnly, AllFilesAreReadBackCorrectly: boolean;
624-
625623
begin
626624
//Update all the torrent files.
627625

@@ -639,8 +637,8 @@ procedure TFormTrackerModify.UpdateTorrent;
639637
begin
640638
//Warn user before updating the torrent
641639
BoxStyle := MB_ICONWARNING + MB_OKCANCEL;
642-
Reply := Application.MessageBox('Warning: There is no undo.',
643-
'Torrent files will be change!', BoxStyle);
640+
Reply := Application.MessageBox('Torrent files will be change!' +
641+
sLineBreak + 'Warning: There is no undo.', '', BoxStyle);
644642
if Reply <> idOk then
645643
begin
646644
ShowHourGlassCursor(True);
@@ -679,9 +677,9 @@ procedure TFormTrackerModify.UpdateTorrent;
679677
if not FConsoleMode and (CountTrackers = 0) then
680678
begin //Torrent without a tracker is posible. But is this what the user realy want? a DHT torrent.
681679
BoxStyle := MB_ICONWARNING + MB_OKCANCEL;
682-
Reply := Application.MessageBox(
683-
'Warning: Create torrent file without any URL of the tracker?',
684-
'There are no Trackers selected!', BoxStyle);
680+
Reply := Application.MessageBox('There are no Trackers selected!' +
681+
sLineBreak + 'Warning: Create torrent file without any URL of the tracker?',
682+
'', BoxStyle);
685683
if Reply <> idOk then
686684
begin
687685
ShowHourGlassCursor(False);
@@ -1317,9 +1315,9 @@ procedure TFormTrackerModify.MenuTrackersAllTorrentArePublicPrivateClick(
13171315
i: integer;
13181316
begin
13191317
//Warn user about torrent Hash.
1320-
if Application.MessageBox(
1318+
if Application.MessageBox('Are you sure!' + sLineBreak +
13211319
'Warning: Changing the public/private torrent flag will change the info hash.',
1322-
'Are you sure!', MB_ICONWARNING + MB_OKCANCEL) <> idOk then
1320+
'', MB_ICONWARNING + MB_OKCANCEL) <> idOk then
13231321
exit;
13241322

13251323
//Set all the trackers publick/private CheckBoxRemoveAllSourceTag ON or OFF
@@ -1422,7 +1420,6 @@ procedure TFormTrackerModify.
14221420
end;
14231421

14241422
procedure TFormTrackerModify.MenuUpdateTorrentAddBeforeRemoveNewClick(Sender: TObject);
1425-
14261423
begin
14271424
//User have selected to add new tracker.
14281425
FTrackerList.TrackerListOrderForUpdatedTorrent :=

0 commit comments

Comments
 (0)