OptionBox()

Source code related resources

Moderator: Rathinagiri

User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: OptionBox()

Post by quartz565 »

Ευχαστώ Pablo !
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

OptionBox()

Post by Pablo César »

Είστε ευπρόσδεκτοι, Νίκος ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: OptionBox()

Post by trmpluym »

Hi Pablo,

I have a small improvement for your fantastic OptionBox. When the lenght of the parameter cTitle1 or cTitle2 is longer than the length of the longest parameter in the array aOptions, cTitle1 or cTitle2 is not displayed right. For example:

Code: Select all

OptionBox("Choice","This is a OptionBox with a very long string in cTitle2",{"TEST1","TEST2"}, 2)
2017-02-04 17_59_29-OptionBox - LongTitle.png
2017-02-04 17_59_29-OptionBox - LongTitle.png (5.14 KiB) Viewed 3459 times
This can be solved by adding 2 lines of code:

Code: Select all

nWidth:=iif(nWidth<GetTextWidth(NIL,cTitle1,FontHandle),GetTextWidth(NIL,cTitle1,FontHandle),nWidth)
nWidth:=iif(nWidth<GetTextWidth(NIL,cTitle2,FontHandle),GetTextWidth(NIL,cTitle2,FontHandle),nWidth)
Now the result is:
2017-02-04 17_59_29-OptionBox - LongTitle 2.png
2017-02-04 17_59_29-OptionBox - LongTitle 2.png (4.43 KiB) Viewed 3459 times
I included the modified version as an attachement.

Theo
Attachments
optionbox.zip
(1.5 MiB) Downloaded 223 times
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: OptionBox()

Post by serge_girard »

Thx Theo !

Serge
There's nothing you can do that can't be done...
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

OptionBox()

Post by Pablo César »

Ohhh you are right to add this.

But you have forgotten to include in your last code:
Function OptionBox( cTitle1, cTitle2, aOptions, nDefault, cIcon )

DEFAULT cIcon := "ZZZ_AAAWINDOW" // Default HMG ICON

OptionBox_Ok(@nRet)

So here's but I would like to solve FontHandle case:
 
OptionBox.rar
Source files
(1.8 KiB) Downloaded 210 times
 
Bedankt Theo :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: OptionBox()

Post by trmpluym »

It is a pleasure working with you Pablo !
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

OptionBox()

Post by Pablo César »

Thank you Theo. It is also very good for me to work together. :)

Welkom degenen die veel van zichzelf te geven filantropische manier. :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply