Hmg4 statusbar

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Hmg4 statusbar

Post by l3whmg »

Hi friends
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
And this with XBase style

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
I'm sorry, but I removed these method: StatusBarTimersAdd and StatusBarKeyBoardAdd.

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
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: Hmg4 statusbar

Post by l3whmg »

Hi friends,

I have rewritten the menus manager (mainmenu, menupopup and menuitem) and I solved
some problems (in example about release method, a better signal event management) and
I removed use of shared vars. But, in this way, I had precluded use of this syntax: formname.itemmenu

with HMG3 we can use this syntax: form.control.value because all the objects are pushed, are linked,
under the form object level. With powerfull functions (setproperty, getproperty and domethod)
HMG3 has the ability to find, set and operate on these objects.
Please: Roberto, Rathinagiri tell me if this concept is wrong.

with HMG4 we must respect (for the moment) the necessity of QT (in other words, a tree representation
of the kinship); we are started with OOP syntax and "with object" nested to replicate the HMG3 philosopy
within end programs. But there are problems or incompatibility or etc.
In this moment I think the best option is to respect the QT necessity and its relationship system.

In this moment, I think the best option is to respect the HMG4/QT rules; on other words, refer to the
objects with entire path (fe formname:mainmenuname:menupopupname1:menupopupname2:.....:menuitemname)
when we need to change or to know properties.

Why I do the menu example?
Because Mauricio has spent a lot of time to find a solution and I want to respect his work.

IMHO, there are a lot of other situations where we don't have - today - a solution and for this and
other reasons, I think we must respect the QT rules about parent system and we must
use - for the moment - the long path to manage control's property.

I will publish a change about menu manager, but it precluded the use of formname.item or formname:item.

Cheers
Luigi from Italy
www.L3W.it
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Hmg4 statusbar

Post by Rathinagiri »

with HMG3 we can use this syntax: form.control.value because all the objects are pushed, are linked,
under the form object level. With powerfull functions (setproperty, getproperty and domethod)
HMG3 has the ability to find, set and operate on these objects.

Yes. What you are saying is correct.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply