OptionBox()

Source code related resources

Moderator: Rathinagiri

User avatar
quartz565
Posts: 500
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Has thanked: 137 times
Been thanked: 13 times
Contact:

Re: OptionBox()

Post by quartz565 » Wed Jan 25, 2017 10:38 pm

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

os: Windows Server 2012 - 64
hw: HP Server E5606, 2.13GHz, 8.00 GB - Intel Xeon CPU

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Wed Jan 25, 2017 10:42 pm

Είστε ευπρόσδεκτοι, Νίκος ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

trmpluym
Posts: 224
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 5 times
Been thanked: 18 times

Post by trmpluym » Sat Feb 04, 2017 5:20 pm

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 736 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 736 times
I included the modified version as an attachement.

Theo
Attachments
optionbox.zip
(1.5 MiB) Downloaded 44 times

User avatar
serge_girard
Posts: 2045
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 404 times
Been thanked: 89 times
Contact:

Post by serge_girard » Sat Feb 04, 2017 5:51 pm

Thx Theo !

Serge

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sat Feb 04, 2017 6:03 pm

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 42 times
 
Bedankt Theo :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

trmpluym
Posts: 224
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 5 times
Been thanked: 18 times

Post by trmpluym » Sat Feb 04, 2017 6:46 pm

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
Has thanked: 100 times
Been thanked: 179 times

Post by Pablo César » Sat Feb 04, 2017 7:58 pm

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