Jump to content
Ian Branch

Multi Input Dialog..

Recommended Posts

Hi Team,

I do not recall where, when or how I came by the original of this Unit.

If the origintor wants to speak up, I am happy to make the appropriate attribution and offer my thanks.

I have made some enhancemants to the original.

MultiInputDlg.rar

I offer it as something to give back to the community, to learn some techniques from, and as a useful Dialog.

Feel free to use/enhance as you wish.

As usual, all care & no responsibility.  😉

Note:  This was enhanced by me for use under D12+.  I don't really know how far back in Delphi versions it will work.

I make no apologies for any poor coding or coding style.

 

Regards,

Ian

Edited by Ian Branch
  • Like 1

Share this post


Link to post

Interesting concept. Thanks for sharing it.

 

I have never heard about this unit before, but I found this page by googling for "TInputRecArray" "Delphi" which looks a lot like your unit. It's a blog post from 2013 on a Chinese site.

 

I think the concept could be improved on by using fluid programming like this:

var
  Value1, Value2, Value3: Variant;

// ...

Success := MultiInputBox(Self)
  .AddField('Enter your age.: ' , 3, ftNumber, 0, Value1)
  .AddField('Enter a hex value.: ', 4, ftHexNumber, 0, Value2)
  .AddField('Enter a float value.: ', 10, ftFloatNumber, Value3)
  .ShowModal;

That could be done by having MultiInputBox return an interface with an AddField function that returns that interface and a ShowModal function that returns the boolean. That interface then internally declares and manages the TInputRecArray.

This saves the boilerplate code of declaring and filling the TInputRecArray and make the code (in my opinion) a lot more readable.

Edited by dummzeuch
  • Like 1

Share this post


Link to post

Hi Thomas,

9 hours ago, dummzeuch said:

I think the concept could be improved on by using fluid programming like this:

No doubt, but that wasn't something I ever got in to.

Yes it would be cleaner.

Feel free.  😉

 

Ian

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×