Recent

Author Topic: Message box  (Read 3026 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Message box
« on: November 25, 2019, 02:34:04 am »
Code: Pascal  [Select][+][-]
  1. function QDialogB : Integer;
  2.   const
  3.   mrNoneNI     = 20;    {20 Skip Button          }
  4.   mrCancelNI   = 21;    {21 Update Button        }
  5. //  mrAbortNI    = 22;    {22 PC ll Button         }
  6.   mrYesNI      = 23;    {23 Airport Button       }
  7.   mrNoNI       = 24;    {24 Airport_Codes Button }
  8.   mrAllNI      = 25;    {25 xxxxxx               }
  9.   mrYesToAllNI = 26;    {26 Exit - Both Loops    }
  10.  
  11.  
  12.  Var Reply : Integer = -1;
  13.  begin
  14.   case QuestionDlg ('Caption', 'Process Item(s)',mtCustom,
  15.                    [mrNoneNI,  'Skip',          {20 - Skip           }
  16.                     mrCancelNI,'UP',            {21 - Update         }
  17. //                    mrAbortNI, 'PC LL',       {22 - PC LL          }
  18.  
  19.                     mrYesNI,   'Airport',       {23 - Airport        }
  20.                     mrNoNI,    'AP-Codes',      {24 - Airport-Codes  }
  21.                     mrAllNI,   'LL',            {25 - Lat/Lon City   }
  22.  
  23.                     mrYesToAllNI,'Exit' ],'') of  {26 - Exit Next(Auto)}
  24.  
  25.  
  26.     mrNoneNI     : Reply := mrNoneNI;           {20 Skip             }
  27.     mrCancelNI   : Reply := mrCancelNI;         {21 Update           }
  28. //    mrAbortNI    : Reply := mrAbortNI;          {22 PC LL            }
  29.  
  30.     mrYesNI      : Reply := mrYesNI;            {23 Airport          }
  31.     mrNoNI       : Reply := mrNoNI;             {24 Airport-Codes    }
  32.     mrAllNI      : Reply := mrAllNI;            {25 Lat/Lon City     }
  33.  
  34.     mrYesToAllNI : Reply := mrYesToAllNI;       {26 Exit             }
  35.  
  36.   end;
  37.   result := reply;
  38.  end;    

I have the above code which works fine. It displays the 6 buttons in a box.

Is there a way to have the six buttons displayed on two line in the box?

Thanks



FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Message box
« Reply #1 on: November 25, 2019, 02:59:48 am »
I would like to know how you found that function  :D

This is the first time I have ever seen it and it appears to be something in the deep end..!

 Looking at the help files I don't see a way for that to happen, if you were doing such things in Lazarus LCL
it would be easy.. to do things like this, just make a Dialog form and there you go.

 I Lazarus there is a TtaskDialog that you can do some nice things with.
The only true wisdom is knowing you know nothing

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Message box
« Reply #2 on: November 25, 2019, 03:19:10 am »
@Jamie

I not sure where? But I think it was posted by hondoko and I adapted it.

I could try and find the posting if it's really important.

I'll Look

FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Message box
« Reply #3 on: November 25, 2019, 11:13:26 am »
Is there a way to have the six buttons displayed on two line in the box?
Not using the QuestionDlg function in Dialogs, since it calls the Widgetset.AskUser() function which does not support multiple rows of buttons.
But a custom dialog could be devised that did this for you.
« Last Edit: November 25, 2019, 02:18:30 pm by howardpc »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Message box
« Reply #4 on: November 25, 2019, 02:15:14 pm »
Hi!

I had a similar problem. It seems that you have to build your own dialog:

Code: Pascal  [Select][+][-]
  1. Type TDiaLogForm = Class (TForm)  
  2. ...
  3. end
  4.  

Now your a free to design the dialog to your needs.

Set the BorderStyle to bsDialog

Use BitBtn : With the property Kind you can set the default system icons (yes, no, cancel..)

With every click on a BitBtn you set another modalresult

Works nice!

Winni

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Message box
« Reply #5 on: November 25, 2019, 06:05:43 pm »
Was hoping for something simple.

@Winni

Don't understand much of what you are saying. Have to play with it some. 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Message box
« Reply #6 on: November 25, 2019, 06:43:27 pm »
See if you can adapt the attached project.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Message box
« Reply #7 on: November 26, 2019, 04:53:48 pm »
@Howardpc

Thanks , Yea I think I can adapt it..
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Message box
« Reply #8 on: December 01, 2019, 05:09:55 am »
@howardpc
Been busy and haven't been able to port your example yet.

Getting an error when I compile and can't figure it out. Have to start fresh again.

@Jamie
I looked, went back about 15 pages of hondoko posts and didn't see it, but I'm sure it was him.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Message box
« Reply #9 on: December 01, 2019, 08:13:05 am »
@Jamie
I looked, went back about 15 pages of hondoko posts and didn't see it, but I'm sure it was him.

I believe this is the post:
https://forum.lazarus.freepascal.org/index.php/topic,44992.msg316911.html#msg316911

And this is the exact code (if you follow the link in the link above):
https://wiki.freepascal.org/Dialog_Examples#QuestionDlg

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Message box
« Reply #10 on: December 01, 2019, 09:06:24 am »
@Jamie

This is what I modified:

Code: Pascal  [Select][+][-]
  1. const
  2.   mrNoneNI=      20;
  3.   mrOkNI=        mrNoneNI+1;
  4.   mrCancelNI=    mrNoneNI+2;
  5.   mrAbortNI=     mrNoneNI+3;
  6.   mrRetryNI=     mrNoneNI+4;
  7.   mrIgnoreNI=    mrNoneNI+5;
  8.   mrYesNI=       mrNoneNI+6;
  9.   mrNoNI=        mrNoneNI+7;
  10.   mrAllNI=       mrNoneNI+8;
  11.   mrYesToAllNI=  mrNoneNI+10;
  12.   mrCloseNI=     mrNoneNI+11;
  13.   mrLastNI=      mrCloseNI;
  14. begin
  15.   case QuestionDlg ('Caption','Message',mtCustom,[mrYesNI,'Positive', mrNoNI, 'Negative',mrCancelNI,'I do not know','IsCancel'],'') of
  16.     mrYesNI: QuestionDlg ('Caption','So you mean „Yes“',mtCustom,[mrYesNI,'That is right'],'');
  17.     mrNoNI:  QuestionDlg ('Caption','Oh, you mean „No“',mtCustom,[mrNoNI,'Exactly'],'');
  18.     mrCancelNI:  QuestionDlg ('Caption','So, please find out!',mtCustom,[mrCancelNI,'Maybe'],'');
  19.   end; //case
  20. end;

@Handoko
Thanks
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018