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
can i use only 1 x TMsgBar() / TStatusBar() in Main
// 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
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
aData := XbrToArray( oBrw )
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.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 93 guests