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

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

Postby Jimmy » Tue Apr 11, 2023 7: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby Antonio Linares » Wed Apr 12, 2023 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Postby karinha » 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: Select all  Expand view  RUN

// 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
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

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

Postby nageswaragunupudi » Wed Apr 12, 2023 12:55 pm

Use this function
Code: Select all  Expand view  RUN
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  RUN
aData := XbrToArray( oBrw )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Antonio Linares » Wed Apr 12, 2023 7: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: Select all  Expand view  RUN

// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests