FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour more than 1 x TMsgBar() / TStatusBar() in App ?
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
more than 1 x TMsgBar() / TStatusBar() in App ?
Posted: Tue Apr 11, 2023 07:41 PM
hi,

in my Main i have a working TMsgBar()

now i open a new Windows / Dialog which have a XBROWSE and i want also a TMsgBar()
but it does not show anything ... no Num,Caps.ins or Fate / Time :shock:

can i use only 1 x TMsgBar() / TStatusBar() in Main :?:
greeting,

Jimmy
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: more than 1 x TMsgBar() / TStatusBar() in App ?
Posted: Wed Apr 12, 2023 05:35 AM

Dear Jimmy,

If you use a main MDI window then each child may have a buttonbar and a messagebar.

Another choice is to use a TPanel, that again may have both.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: more than 1 x TMsgBar() / TStatusBar() in App ?
Posted: Wed Apr 12, 2023 10:28 AM
Taking advantage of the topic, Master Ant么nio is it possible to do this?
Aprovechando el tema, Maestro Ant么nio, 驴es posible hacer esto?

GET and COMBO in the MESSAGE Bar?
GET y COMBO en la barra de MENSAJES
Code (fw): Select all Collapse
// GET e COMBO na MESSAGE Bar

#include "FiveWin.ch"

#define MSG_DATA 1
#define MSG_EMP 2
#define MSG_RDD 3

STATIC oWnd

FUNCTION Main()

聽 聽LOCAL oBarData, oBarData1, oBarData2, oMainFont, OGET
聽 聽LOCAL oMainBar
聽 聽LOCAL oCbx1
聽 聽LOCAL oGetData
聽 聽LOCAL dData := Date()
聽 聽LOCAL cCombo := Space( 1 )
聽 聽LOCAL aItens := { 'EMPRESA 1', 'EMPRESA 2', 'EMPRESA 3', 'EMPRESA 4', 'EMPRESA 5' }

聽 聽SET CENTURY ON
聽 聽SET DATE ITALIAN

聽 聽DEFINE FONT oMainFont NAME "Arial" SIZE 0, 14 WEIGHT 0

聽 聽DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 TITLE "Inserindo GET e COMBOBOX na Message Bar" MENU BuildMenu()

聽 聽// Define a bar de status da janela principal
聽 聽DEFINE MESSAGE BAR oMainBar OF oWnd CENTER // NOINSET

聽 聽oMainBar:nHeight := 31 // nao consegui alterar a altura do COMBO por isto almentei a altura da MESSAGE

聽 聽// define os itens da message bar
聽 聽DEFINE MSGITEM oBarData OF oMainBar PROMPT '' SIZE 100 ACTION SetData( oGet )
聽 聽DEFINE MSGITEM oBarData1 OF oMainBar PROMPT '' SIZE 100 ACTION SetEmp( oCbx1 )
聽 聽DEFINE MSGITEM oBarData2 OF oMainBar PROMPT '' SIZE 100

聽 聽oWnd:oMsgBar:aItem[ MSG_DATA ]:SetText( Date() )

聽 聽oWnd:oMsgBar:aItem[ MSG_EMP ]:SetText( 'EMPRESA 1' )

聽 聽// calcula coordenadas dos itens da MSGBAR
聽 聽// nLinBar := oWnd:oMsgBar:nTop // topo da MSGBAR
聽 聽// nColData := oWnd:oMsgBar:aItem[MSG_DATA]:nLeft // coluna da data da MSGBAR
聽 聽// nColEmp := oWnd:oMsgBar:aItem[MSG_EMP]:nLeft // coluna da empresa da MSGBAR

聽 聽// cria o GET
聽 聽@ 0, 0 GET oGet VAR dData OF oWnd SIZE 92, 21 PIXEL FONT oMainFont CENTER

聽 聽oGet:Hide() // esconde o GET
聽 聽oGet:bChange := {|| VlData( oGet ) } // le teclas pressionadas
聽 聽oGet:bKeyDown := {|| VlData( oGet ) } // le tecla ESC

聽 聽// cria o COMBO

聽 聽// @ nLinBar+5, nColEmp COMBOBOX oCbx1 VAR cCombo ;
聽 聽@ 0, 0 COMBOBOX oCbx1 VAR cCombo ;
聽 聽 聽 ITEMS aItens ;
聽 聽 聽 OF oWnd ;
聽 聽 聽 SIZE 93, 100 ;
聽 聽 聽 PIXEL ;
聽 聽 聽 ON CHANGE VlEmp( oCbx1 ) ;
聽 聽 聽 STYLE CBS_DROPDOWNLIST ;
聽 聽 聽 FONT oMainFont

聽 聽//oCbx1:Hide() // esconde o COMBO

聽 聽ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION BuildMenu()

聽 聽LOCAL oMenu

聽 聽MENU oMenu

聽 聽 聽 MENUITEM "&Information"

聽 聽MENU

聽 聽MENUITEM "&About..." ACTION MsgAbout( "FiveWin", "FiveTech" )

聽 聽SEPARATOR

聽 聽MENUITEM "&End..." ACTION oWnd:End()

聽 聽ENDMENU

聽 聽MENUITEM "&Child Windows"

聽 聽MENU

聽 聽 聽 MENUITEM "&Tiled" ACTION oWnd:Tile()

聽 聽 聽 MENUITEM "&Cascade" ACTION oWnd:Cascade()

聽 聽ENDMENU

聽 聽ENDMENU

RETURN oMenu

STATIC FUNCTION SetData( oGet )

聽 聽oGet:nTop 聽:= oWnd:oMsgBar:nTop + 5 // topo da MSGBAR
聽 聽oGet:nLeft := oWnd:oMsgBar:aItem[ MSG_DATA ]:nLeft // coluna da data da MSGBAR

聽 聽oGet:Show()
聽 聽oGet:Enable()
聽 聽oGet:SetFocus()
聽 聽oGet:SelectAll()

聽 聽// desabilita a MSGBAR

聽 聽oWnd:oMsgBar:Disable()

RETURN NIL

STATIC FUNCTION VlData( oGet )

聽 聽// testa a tecla ENTER e a validacao do GET
聽 聽IF oGet:nLastKey == VK_RETURN .AND. oGet:lValid

聽 聽 聽 oWnd:oMsgBar:aItem[ MSG_DATA ]:SetText( oGet:VarGet() ) // -> esta linha nao vai existir

聽 聽 聽 // SCData(oGet:VarGet())

聽 聽 聽 oGet:Hide()

聽 聽 聽 oGet:Disable()

聽 聽 聽 // abilita a MSGBAR

聽 聽 聽 oWnd:oMsgBar:Enable()

聽 聽ENDIF

聽 聽// testa tecla ESC
聽 聽IF oGet:nLastKey == VK_ESCAPE

聽 聽 聽 oGet:Hide()

聽 聽 聽 oGet:Disable()

聽 聽 聽 // abilita a MSGBAR

聽 聽 聽 oWnd:oMsgBar:Enable()

聽 聽ENDIF

RETURN NIL

STATIC FUNCTION SetEmp( oCbx )

聽 聽oCbx:nTop := oWnd:oMsgBar:nTop + 5 // topo da MSGBAR

聽 聽oCbx:nLeft := oWnd:oMsgBar:aItem[ MSG_EMP ]:nLeft // coluna da empresa da MSGBAR

聽 聽oCbx:Show()

聽 聽// posiciona o COMBOBOX
聽 聽oCbx:Set( oWnd:oMsgBar:aItem[ MSG_EMP ]:cMsg )
聽 聽oCbx:Enable()
聽 聽oCbx:SetFocus()

聽 聽// desabilita a MSGBAR
聽 聽oWnd:oMsgBar:Disable()

RETURN NIL

STATIC FUNCTION VlEmp( oCbx )

聽 聽oCbx:Hide()
聽 聽oCbx:Disable()

聽 聽// abilita a MSGBAR
聽 聽oWnd:oMsgBar:Enable()

聽 聽// atualiza a MSGBAR
聽 聽oWnd:oMsgBar:aItem[ MSG_EMP ]:SetText( oCbx:VarGet() )

RETURN NIL

// FIN / END
Muchas gracias. Many thanks.

Regards, saludos.
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: more than 1 x TMsgBar() / TStatusBar() in App ?
Posted: Wed Apr 12, 2023 12:55 PM
Use this function
Code (fw): Select all Collapse
function XbrToArray( Self, aCols )

聽 聽local aData 聽 聽:= {}
聽 聽local nRows 聽 聽:= ::nLen
聽 聽local nRow, bm

聽 聽if nRows > 0
聽 聽 聽 if aCols == nil
聽 聽 聽 聽 聽aCols 聽 聽:= ::GetVisibleCols()
聽 聽 聽 else
聽 聽 聽 聽 聽aCols 聽 聽:= { |o,i| aCols[ i ] := ::oCol( i ) }
聽 聽 聽 endif

聽 聽 聽 aData 聽 聽 聽 := Array( nRows, Len( aCols ) )

聽 聽 聽 bm 聽 聽 聽 聽 聽:= ::BookMark
聽 聽 聽 Eval( ::bGoTop, Self )

聽 聽 聽 for nRow := 1 to nRows
聽 聽 聽 聽 聽AEval( aCols, { |o,i| aData[ nRow, i ] := o:Value } )
聽 聽 聽 聽 聽Eval( ::bSkip, 1 )
聽 聽 聽 next

聽 聽 聽 ::BookMark 聽:= bm

聽 聽endif

return aData
Usage:
Code (fw): Select all Collapse
aData := XbrToArray( oBrw )
Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: more than 1 x TMsgBar() / TStatusBar() in App ?
Posted: Wed Apr 12, 2023 07:29 PM
karinha wrote:Taking advantage of the topic, Master Ant么nio is it possible to do this?
Aprovechando el tema, Maestro Ant么nio, 驴es posible hacer esto?

GET and COMBO in the MESSAGE Bar?
GET y COMBO en la barra de MENSAJES
Code (fw): Select all Collapse
// GET e COMBO na MESSAGE Bar

#include "FiveWin.ch"

#define MSG_DATA 1
#define MSG_EMP 2
#define MSG_RDD 3

STATIC oWnd

FUNCTION Main()

聽 聽LOCAL oBarData, oBarData1, oBarData2, oMainFont, OGET
聽 聽LOCAL oMainBar
聽 聽LOCAL oCbx1
聽 聽LOCAL oGetData
聽 聽LOCAL dData := Date()
聽 聽LOCAL cCombo := Space( 1 )
聽 聽LOCAL aItens := { 'EMPRESA 1', 'EMPRESA 2', 'EMPRESA 3', 'EMPRESA 4', 'EMPRESA 5' }

聽 聽SET CENTURY ON
聽 聽SET DATE ITALIAN

聽 聽DEFINE FONT oMainFont NAME "Arial" SIZE 0, 14 WEIGHT 0

聽 聽DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 TITLE "Inserindo GET e COMBOBOX na Message Bar" MENU BuildMenu()

聽 聽// Define a bar de status da janela principal
聽 聽DEFINE MESSAGE BAR oMainBar OF oWnd CENTER // NOINSET

聽 聽oMainBar:nHeight := 31 // nao consegui alterar a altura do COMBO por isto almentei a altura da MESSAGE

聽 聽// define os itens da message bar
聽 聽DEFINE MSGITEM oBarData OF oMainBar PROMPT '' SIZE 100 ACTION SetData( oGet )
聽 聽DEFINE MSGITEM oBarData1 OF oMainBar PROMPT '' SIZE 100 ACTION SetEmp( oCbx1 )
聽 聽DEFINE MSGITEM oBarData2 OF oMainBar PROMPT '' SIZE 100

聽 聽oWnd:oMsgBar:aItem[ MSG_DATA ]:SetText( Date() )

聽 聽oWnd:oMsgBar:aItem[ MSG_EMP ]:SetText( 'EMPRESA 1' )

聽 聽// calcula coordenadas dos itens da MSGBAR
聽 聽// nLinBar := oWnd:oMsgBar:nTop // topo da MSGBAR
聽 聽// nColData := oWnd:oMsgBar:aItem[MSG_DATA]:nLeft // coluna da data da MSGBAR
聽 聽// nColEmp := oWnd:oMsgBar:aItem[MSG_EMP]:nLeft // coluna da empresa da MSGBAR

聽 聽// cria o GET
聽 聽@ 0, 0 GET oGet VAR dData OF oWnd SIZE 92, 21 PIXEL FONT oMainFont CENTER

聽 聽oGet:Hide() // esconde o GET
聽 聽oGet:bChange := {|| VlData( oGet ) } // le teclas pressionadas
聽 聽oGet:bKeyDown := {|| VlData( oGet ) } // le tecla ESC

聽 聽// cria o COMBO

聽 聽// @ nLinBar+5, nColEmp COMBOBOX oCbx1 VAR cCombo ;
聽 聽@ 0, 0 COMBOBOX oCbx1 VAR cCombo ;
聽 聽 聽 ITEMS aItens ;
聽 聽 聽 OF oWnd ;
聽 聽 聽 SIZE 93, 100 ;
聽 聽 聽 PIXEL ;
聽 聽 聽 ON CHANGE VlEmp( oCbx1 ) ;
聽 聽 聽 STYLE CBS_DROPDOWNLIST ;
聽 聽 聽 FONT oMainFont

聽 聽//oCbx1:Hide() // esconde o COMBO

聽 聽ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION BuildMenu()

聽 聽LOCAL oMenu

聽 聽MENU oMenu

聽 聽 聽 MENUITEM "&Information"

聽 聽MENU

聽 聽MENUITEM "&About..." ACTION MsgAbout( "FiveWin", "FiveTech" )

聽 聽SEPARATOR

聽 聽MENUITEM "&End..." ACTION oWnd:End()

聽 聽ENDMENU

聽 聽MENUITEM "&Child Windows"

聽 聽MENU

聽 聽 聽 MENUITEM "&Tiled" ACTION oWnd:Tile()

聽 聽 聽 MENUITEM "&Cascade" ACTION oWnd:Cascade()

聽 聽ENDMENU

聽 聽ENDMENU

RETURN oMenu

STATIC FUNCTION SetData( oGet )

聽 聽oGet:nTop 聽:= oWnd:oMsgBar:nTop + 5 // topo da MSGBAR
聽 聽oGet:nLeft := oWnd:oMsgBar:aItem[ MSG_DATA ]:nLeft // coluna da data da MSGBAR

聽 聽oGet:Show()
聽 聽oGet:Enable()
聽 聽oGet:SetFocus()
聽 聽oGet:SelectAll()

聽 聽// desabilita a MSGBAR

聽 聽oWnd:oMsgBar:Disable()

RETURN NIL

STATIC FUNCTION VlData( oGet )

聽 聽// testa a tecla ENTER e a validacao do GET
聽 聽IF oGet:nLastKey == VK_RETURN .AND. oGet:lValid

聽 聽 聽 oWnd:oMsgBar:aItem[ MSG_DATA ]:SetText( oGet:VarGet() ) // -> esta linha nao vai existir

聽 聽 聽 // SCData(oGet:VarGet())

聽 聽 聽 oGet:Hide()

聽 聽 聽 oGet:Disable()

聽 聽 聽 // abilita a MSGBAR

聽 聽 聽 oWnd:oMsgBar:Enable()

聽 聽ENDIF

聽 聽// testa tecla ESC
聽 聽IF oGet:nLastKey == VK_ESCAPE

聽 聽 聽 oGet:Hide()

聽 聽 聽 oGet:Disable()

聽 聽 聽 // abilita a MSGBAR

聽 聽 聽 oWnd:oMsgBar:Enable()

聽 聽ENDIF

RETURN NIL

STATIC FUNCTION SetEmp( oCbx )

聽 聽oCbx:nTop := oWnd:oMsgBar:nTop + 5 // topo da MSGBAR

聽 聽oCbx:nLeft := oWnd:oMsgBar:aItem[ MSG_EMP ]:nLeft // coluna da empresa da MSGBAR

聽 聽oCbx:Show()

聽 聽// posiciona o COMBOBOX
聽 聽oCbx:Set( oWnd:oMsgBar:aItem[ MSG_EMP ]:cMsg )
聽 聽oCbx:Enable()
聽 聽oCbx:SetFocus()

聽 聽// desabilita a MSGBAR
聽 聽oWnd:oMsgBar:Disable()

RETURN NIL

STATIC FUNCTION VlEmp( oCbx )

聽 聽oCbx:Hide()
聽 聽oCbx:Disable()

聽 聽// abilita a MSGBAR
聽 聽oWnd:oMsgBar:Enable()

聽 聽// atualiza a MSGBAR
聽 聽oWnd:oMsgBar:aItem[ MSG_EMP ]:SetText( oCbx:VarGet() )

RETURN NIL

// FIN / END
Muchas gracias. Many thanks.

Regards, saludos.
Dear Joao,

To place controls on top of another control use the clause OF:

@ ..., ... GET ... OF oBar

same for combobox and others :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion