Page 1 of 1

more than 1 x TMsgBar() / TStatusBar() in App ?

PostPosted: Tue Apr 11, 2023 7:41 pm
by Jimmy
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 :?:

Re: more than 1 x TMsgBar() / TStatusBar() in App ?

PostPosted: Wed Apr 12, 2023 5:35 am
by Antonio Linares
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.

Re: more than 1 x TMsgBar() / TStatusBar() in App ?

PostPosted: Wed Apr 12, 2023 10:28 am
by karinha
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: Select all  Expand view

// 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.

Re: more than 1 x TMsgBar() / TStatusBar() in App ?

PostPosted: Wed Apr 12, 2023 12:55 pm
by nageswaragunupudi
Use this function
Code: Select all  Expand view
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: Select all  Expand view
aData := XbrToArray( oBrw )

Re: more than 1 x TMsgBar() / TStatusBar() in App ?

PostPosted: Wed Apr 12, 2023 7:29 pm
by Antonio Linares
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: Select all  Expand view

// 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 :-)