OptionBox()
Moderator: Rathinagiri
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
OptionBox()
Thank you big boss Roberto for nice and simple solution.Roberto Lopez wrote: ↑Fri Jul 01, 2016 12:19 pmThis is a simple function. You could add it to your own code (using the IDE or not).tonton2 wrote:Hello to all the team,
how to use this program with IDE
Thank you for your help
I've already started using it but with some changes.
Attached is my contribution with following improving:
- Fixed overwriting control display in RadioGroup items on frame
- Added multilanguage support in buttons
- Autoadjustable width sizes (form, and RadioGroup) by size of items and size o Title and buttons centralized
- Optional title in frame. Useful when form title is too long.
- FontSize definition for whole controls
I hope you enjoy
I know that we still need to improve the ItemsMaxLen function for the FontHandle could work correctly, especially if the FontSize changes.
I could not get FontHandle because at this stage there is no control nor form created yet. I think that for you want to work with source change you must enable the line:
Code: Select all
AEVAL( aItems, { | cItem | nMxLn := Max( nMxLn, HMG_Len( cItem ) * nFontSize * .8 ) } )
This is with FontSize 12 (exaggerated but automatic adjustment working, just for fun).
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- serge_girard
- Posts: 3199
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: OptionBox()
Hi Roberto,
Thanks for this great new function ! Very useful !
Here some minor improvements based on the last modified version of Pablo:
(1) Centre in parent Window when a parent window is defined
ASCAN( _HMG_SYSDATA[69], "A" ) > 0 if a MAIN window is defined
_HMG_MainWindowFirst==.F. when SET WINDOW MAIN OFF (like Pablo uses often)
(2) nRet variable changed from PRIVATE to LOCAL
And
Without the PRIVATE variable i can use the nRet variable 'safely' in other code.
Thanks for this great new function ! Very useful !
Here some minor improvements based on the last modified version of Pablo:
(1) Centre in parent Window when a parent window is defined
Code: Select all
IF ASCAN( _HMG_SYSDATA[69], "A" ) > 0 .AND. _HMG_MainWindowFirst==.T.
cParentWindowName:=ThisWindow.Name
CENTER WINDOW OPTIONBOX IN &cParentWindowName
ELSE
CENTER WINDOW OPTIONBOX DESKTOP
ENDIF
_HMG_MainWindowFirst==.F. when SET WINDOW MAIN OFF (like Pablo uses often)
(2) nRet variable changed from PRIVATE to LOCAL
Code: Select all
DEFINE BUTTON CANCEL
ROW 110 + ( 30 * ( LEN(aOptions) - 2 ) )
COL nColButtons + 110
CAPTION cCaption2
ACTION OptionBox_Cancel(@nRet)
FONTNAME "Arial"
FONTSIZE nFontSize
END BUTTON
ON KEY ESCAPE ACTION OptionBox_Cancel(@nRet)
Code: Select all
Function OptionBox_Cancel(nRet)
ThisWindow.RELEASE
SET WINDOW MAIN ON
Return Nil
- Attachments
-
- msgbox.zip
- (1.5 MiB) Downloaded 250 times
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
OptionBox()
Dank u Theo !
Ik vergat je aangegeven centralisatie.
I am adopting your changes, thanks again
Ik vergat je aangegeven centralisatie.
I am adopting your changes, thanks again
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: OptionBox()
Você é meu amigo Pablo!
+1
+1
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
OptionBox()
Thank Theo, you are as my friend too !
I think we can add an optional parameter giving chance to include personalized ICON at this window of OptionBox()
But do not forget to:
- Remove NOSYSMENU at DEFINE WINDOW OPTIONBOX
- Change LOCAL cParentWindowName, nRet for LOCAL cParentWindowName, nRet: = 0 based on Theo example
- Add the 5th parameter and variable for ICON name
- Add ON RELEASE (nRet := 0) to the end of DEFINE WINDOW OPTIONBOX
- Changed MODAL by TOPMOST
- To fix Cancel option at line after Function OptionBox_Cancel(nRet) add nRet := 0.
Otherwise always will wrong return the value of RadioGroup (never as zero)
<Attached file was removed due there is a newest version ahead this topic (fixed bug)>
I hope you like it.
Last edited by Pablo César on Mon Jan 23, 2017 5:27 pm, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
OptionBox()
There was two bugs due removing NOSYSMENU and missing pass variable as reference (@).
Button "x" for exit form interferes when be cRet equal to zero or when is valid radioGroup value.
So, I have disabled this button with:
SetProperty("OPTIONBOX","NOCLOSE",.T.)
And also was fixed/added OptionBox_Ok(@nRet) due cRet now is not PRIVATE as Theo has recommended.
Here's fixed version:
Sorry for my mistake.
Button "x" for exit form interferes when be cRet equal to zero or when is valid radioGroup value.
So, I have disabled this button with:
SetProperty("OPTIONBOX","NOCLOSE",.T.)
And also was fixed/added OptionBox_Ok(@nRet) due cRet now is not PRIVATE as Theo has recommended.
Here's fixed version:
Sorry for my mistake.
Last edited by Pablo César on Mon Jan 23, 2017 5:32 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: OptionBox()
Perfect Pablo, the function improves everytime
Theo
Theo
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
OptionBox()
Bedankt Theo!
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein