Before do a commit I want inform you regarding a significant change: I rewrited the source code about "statusbar".
The big difference is that we have five different objects: STATUSBAR, STATUSITEM, STATUSCLOCK, STATUSDATE and STATUSKEYB
Here a brief example with OOP style
Code: Select all
WITH OBJECT StatusBar():New( "StatBarName" )
:FontName := "Arial"
:FontSize := 12
WITH OBJECT StatusItem():New( "StatItem1" )
:Caption := "StatusItem1"
:OnClick := { || StsItm1OnClick() }
:ToolTip := "Click on me"
:Icon := "bookclose.png"
:Width := 200
END WITH
WITH OBJECT StatusClock():New( "StatClock1" )
:OnClick := { || StsClk1OnClick() }
:ToolTip := "Clock1 ToolTip"
END WITH
WITH OBJECT StatusDate():New( "StatDate1" )
:OnClick := { || StsDte1OnClick() }
:ToolTip := "Date1 ToolTip"
END WITH
WITH OBJECT StatusKeyb():New( "StatKeyb1" )
:OnClick := { || StsKyb1OnClick() }
:ToolTip := "Keyb1 ToolTip"
END WITH
WITH OBJECT StatusItem():New( "StatItem2" )
:Caption := "This will be removed"
:ToolTip := "This will be removed"
:Width := 200
:Icon := "stopball.png"
END WITH
END WITH
Code: Select all
DEFINE STATUSBAR // nb about HMG3 compatibility the Name will be StatusBar
FONTNAME "Arial"
FONTSIZE 12
// REMEMBER caption text is NOT the HMG4 name
STATUSITEM "Status Item" WIDTH 200 ACTION StsItm1OnClick() ICON "bookclose.png" TOOLTIP "Click on me"
CLOCK ACTION StsClk1OnClick() TOOLTIP "Clock1 ToolTip"
DATE ACTION StsDte1OnClick() TOOLTIP "Date1 ToolTip"
KEYBOARD ACTION StsKyb1OnClick() TOOLTIP "Keyb1 ToolTip"
STATUSITEM "This will be removed" WIDTH 200 ICON "StopBall.png" TOOLTIP "This will be removed"
END STATUSBAR
Now we have:
- StatusDateAdd related with StatusDate object
- StatusClockAdd related with StatusClock object
- StatusKeybAdd related with StatusKeyb object
- StatusItemAdd related with StatusItem object
All these commands, to kept HMG4 compatibility, have additional parameters (cName and oParent):
- METHOD StatusDateAdd( cName, oParent, nWidth, bBlock, lFlat, lRaised, cToolTip ) CLASS STATUSBAR
- METHOD StatusClockAdd( cName, oParent, nWidth, bBlock, lFlat, lRaised, cToolTip ) CLASS STATUSBAR
- METHOD StatusKeybAdd( cName, oParent, nWidth, bBlock, lFlat, lRaised, cToolTip ) CLASS STATUSBAR
- METHOD StatusItemAdd( cName, oParent, cCaption, nWidth, bBlock, cIcon, lFlat, lRaised, cToolTip ) CLASS STATUSBAR
But these methods are used with translation commands and now they are:
- #xcommand DATE [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ];
- #xcommand CLOCK [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ];
- #xcommand KEYBOARD [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ];
- #xcommand STATUSITEM <cItemCaption> [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ];
- #xcommand DEFINE STATUSBAR [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ] ;
To match HMG4 capabilities with HMG3 style, there are these methods (O = old, N = new):
Code: Select all
O - Item( nIndex, cCaption ) usage FormName.StatusBar.Item(1) or FormName.StatusBar.Item(1, "NewCaption")
explanation: to know or to update the caption of an item using index reference
N - ItemCount() usage FormName.StatusBar.ItemCount()
explanation: to know how many itmes it has
O - ItemIcon( nIndex, cIcon ) usage FormName.StatusBar.ItemIcon(1) or FormName.StatusBar.ItemIcon(1, "newimage.png")
explanation: to know or to update the icon of an item using index reference
N - ItemRaised( nIndex, [.T.|.F.] ) usage FormName.StatusBar.ItemRaised(1) or FormName.StatusBar.ItemRaised(1, .F.)
explanation: to know or to update the raised option of an item using index reference
N - ItemRelease( nIndex )
explanation: to remove an item using index reference. About OOP style is FormName:StatBar:StatItemName:Release
With OOP style (not translated for HMG3 style) there is a new method for StatusDate, StatusClock, and StatusKeyb objects: its name it is StartStop. With this method you can suspend or restart the internal timer.
Usage: lStatus := MainForm:StatBarName:StatClock1:StartStop().
nb. when a new object is Created, the internal timer is started so you can suspend or restart the internal timer with StartStop().
I must do some test but ASAP I will do a commit.
Cheers