Page 4 of 4

Re: OptionBox()

Posted: Wed Jan 25, 2017 10:38 pm
by quartz565
Ευχαστώ Pablo !

OptionBox()

Posted: Wed Jan 25, 2017 10:42 pm
by Pablo César
Είστε ευπρόσδεκτοι, Νίκος ! :D

Re: OptionBox()

Posted: Sat Feb 04, 2017 5:20 pm
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 3584 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 3584 times
I included the modified version as an attachement.

Theo

Re: OptionBox()

Posted: Sat Feb 04, 2017 5:51 pm
by serge_girard
Thx Theo !

Serge

OptionBox()

Posted: Sat Feb 04, 2017 6:03 pm
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 217 times
 
Bedankt Theo :)

Re: OptionBox()

Posted: Sat Feb 04, 2017 6:46 pm
by trmpluym
It is a pleasure working with you Pablo !

OptionBox()

Posted: Sat Feb 04, 2017 7:58 pm
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