Page 1 of 1

How to freeze button on DCSTATUSBAR

Posted: Sat Apr 18, 2015 10:41 am
by jdsoft
Hello

There is an vertical status bar.

Code: Select all

DCSTATUSBAR oStat WIDTH 200 ALIGN DCGUI_ALIGN_LEFT ;
      TYPE XBPSTATIC_TYPE_TEXT;  
      EVAL {|o|o:setColorBG(GRA_CLR_WHITE} PARENT oDlg ;
Now I want a button that is anchord (position {5,5}) to the left-bottom of the statusbar.
It should remain always visible also when main dialog (and statusbar) are resized.

How can I do this ?

Regards,
Jack Duijf

Re: How to freeze button on DCSTATUSBAR

Posted: Sun Apr 19, 2015 4:18 am
by jdsoft
Already found out.

Using the SUBCLASS directive

Code: Select all

DCSTATUSBAR oStat WIDTH TB_BAR_WIDTH ALIGN DCGUI_ALIGN_LEFT ;
      TYPE XBPSTATIC_TYPE_TEXT;
      PARENT oDlg ;
      SUBCLASS "SN_STATUSBAR()"
Then add a button and store the Dc_XbpPushbutton object is a getset function FullScreenButton()

Code: Select all

@ nPos,  10 DCPUSHBUTTON CAPTION ICON_FULLSCREEN SIZE 30,30 PIXEL ACTION {||Toggle_FullScreen()} PARENT oStat EVAL {|o|FullScreenButton(o)} WHEN {||TRUE} FANCY
Whenever the dialog and toolbar is resized, the button fixed to the bottom of the toolbar.

Code: Select all

CLASS SN_STATUSBAR FROM  DC_XbpStatusBar
EXPORTED
METHOD      Create
METHOD      ShowButton
ENDCLASS

METHOD SN_STATUSBAR:Create( oParent, oOwner, aPos, aSize, aPres, lVisible )
LOCAL bResize        := nil
::DC_XbpStatusBar:Create( oParent, oOwner, aPos, aSize, aPres, lVisible )
bResize              := ::Resize
If ValType(::Resize) = "B"
   ::Resize          := {||Eval(bResize),::ShowButton()}
Else
   ::Resize          := {||::Showbutton()}
Endif
Return SELF

METHOD  SN_STATUSBAR:ShowButton()
LOCAL oButton        := FullScreenButton()
If ValType(oButton) = "O"
   oButton:SetPos({5,5})
Endif
Return
Regards,
Jack Duijf

Re: How to freeze button on DCSTATUSBAR

Posted: Sun Apr 19, 2015 8:05 am
by rdonnay
Nice work.