FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour TMsgBar: Ayuda por favor.... RESUELTO!!!
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
TMsgBar: Ayuda por favor.... RESUELTO!!!
Posted: Fri Oct 07, 2011 06:56 PM
Saludos amigos del foro:

Tengo un problema con TMsgBar, algunos TMsgItem capturan el fondo de la pantalla al iniciarse el programa con la nueva FWH1109



eso no suced铆a con la FWH0907



Algo estoy haciendo mal, porque ya compile el ejemplo TestMbar y esta OK

Es algo con

Code (fw): Select all Collapse
oMsgItem:SetText( cTexto )


驴Que estoy haciendo mal?

De antemano, gracias

Rolando.
Saludos desde Cochabamba, Bolivia
Posts: 408
Joined: Fri Jan 29, 2010 08:14 PM
Re: TMsgBar: Ayuda por favor
Posted: Sat Oct 08, 2011 03:47 AM
Hola RSalazarU;

Pon el c贸digo para ver donde tienes el fallo, porque yo uso la FWH1109 y a mi me funciona correctamente:

Barra con estilo 2007


Barra sin estilo 2007


Un saludo
JLL
Libreria: FWH/FWH1109 + Harbour 5.8.2 + Borland C++ 5.8.2
Editor de Recursos: PellecC
ADA, OURXDBU
S.O: XP / Win 7 /Win10
Blog: http://javierlloris.blogspot.com.es/
e-mail: javierllorisprogramador@gmail.com
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
Re: Encontre el problema
Posted: Thu Oct 13, 2011 01:25 AM
Saludos JLL:

Al comparar el c贸digo de TMsgItem encontr茅 el siguiente cambio en el m茅todo PAINT

Ver 907
Code (fw): Select all Collapse
 聽 if ::oMsgBar:l2007
聽 聽 聽 ::oMsgBar:PaintBar( nLeft, ::nWidth )
聽 聽endif


Ver 1109
Code (fw): Select all Collapse
 聽 if ::oMsgBar:l2007 .or. ::oMsgBar:l2010
聽 聽 聽 ::oMsgBar:PaintBar( nLeft, ::nWidth )
聽 聽 聽 hDCMem = CreateCompatibleDC( hDC )
聽 聽 聽 If ::hBack == NIL
聽 聽 聽 聽 聽::hBack 聽= CreateCompatibleBitmap( hDC, ::nWidth + 4, ::oMsgBar:nHeight )
聽 聽 聽 聽 聽hOld = SelectObject( hDCMem, ::hBack )
聽 聽 聽 聽 聽BitBlt( hDCMem, 0, 0, ::nWidth + 4, ::oMsgBar:nHeight, hDC, ::nLeft() - 4, 0, 0xCC0020 )
聽 聽 聽 聽 聽SelectObject( hDCMem, hOld )
聽 聽 聽 endif
聽 聽 聽 hOld = SelectObject( hDCMem, ::hBack )
聽 聽 聽 BitBlt( hDC, ::nLeft() - 4, 0, ::nWidth + 4, ::oMsgBar:nHeight, hDCMem, 0, 0, 0xCC0020 )
聽 聽 聽 DeleteDC( hDCMem )
聽 聽endif


Creo que el problema esta relacionado con ::hBack

y para probarlo modifique el ejemplo testmbar

Code (fw): Select all Collapse
// Testing Bitmaps in the MsgBar

#include "FiveWin.ch"

static oWnd

//----------------------------------------------------------------------------//

function Main()

聽 聽local lMail := .t., oBar

聽 聽local oMsgItem, oMsgItemMail

聽 聽DEFINE WINDOW oWnd TITLE "Testing MsgBar with bitmaps"

聽 聽DEFINE BUTTONBAR oBar OF oWnd _3D

聽 聽@ 10,10 CHECKBOX lMail PROMPT "E-Mail" 聽OF oWnd ;
聽 聽 聽 聽 聽 聽SIZE 200, 35 COLOR CLR_BLACK ;
聽 聽 聽 聽 聽 聽ON CHANGE If( ! lMail, oWnd:oMsgBar:DelItem( oMsgItemMail ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oWnd:oMsgBar:InsItem( oMsgItemMail, 2 ) )

聽 聽SET MESSAGE OF oWnd TO "I may use different bitmaps" 2007

聽 聽DEFINE MSGITEM oMsgItem OF oWnd:oMsgBar ;
聽 聽 聽 聽 聽 PROMPT "Lock" ;
聽 聽 聽 聽 聽 SIZE 60 ;
聽 聽 聽 聽 聽 BITMAPS "..\bitmaps\16x16\lock.bmp", "..\bitmaps\16x16\unlock.bmp" ;
聽 聽 聽 聽 聽 ACTION ( oMsgItem:lActive := !oMsgItem:lActive, oMsgItem:Paint() )

聽 聽DEFINE MSGITEM oMsgItemMail OF oWnd:oMsgBar ;
聽 聽 聽 聽 聽 SIZE 24 ;
聽 聽 聽 聽 聽 BITMAPS "..\bitmaps\16x16\MAIL.BMP" ;
聽 聽 聽 聽 聽 TOOLTIP "Check the email" + CRLF + "Get email"

聽 聽DEFINE MSGITEM OF oWnd:oMsgBar ;
聽 聽 聽 聽 聽 BITMAPS "..\bitmaps\16x16\PRINTER.BMP" ;
聽 聽 聽 聽 聽 ACTION PrinterSetup() ;
聽 聽 聽 聽 聽 TOOLTIP "Setup the printer"

聽 聽oWnd:oMsgBar:DateOn()
聽 聽oWnd:oMsgBar:ClockOn()

聽 聽oMsgItem:SetText("Bloqueo") //<--- ACA EL PROBLEMA!!!!!!!!!!!!!!!!!!

聽 聽ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//


El problema ocurre cuando se quiere cambiar el mensaje a un 铆tem antes de activar la ventana. Si se cambia el mensaje una vez activada la ventana todo OK.

Mi problema ahora es llevar ese c贸digo al bOnInit de la ventana, lo cual va a ser dif铆cil en mi caso.

Por el momento tuve que eliminar ese c贸digo en la clase TMsgItem y volver a compilar

Bueno, espero se solucione de alguna forma o tendr茅 que cambiar bastante c贸digo.

Atentamente,


Rolando.
Saludos desde Cochabamba, Bolivia
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TMsgBar: Ayuda por favor
Posted: Thu Oct 13, 2011 07:22 PM

Rolando,

Por favor, en la clase original TMsgItem implementa este cambio y comprueba si asi te funciona bien:

METHOD SetText( cMsg ) INLINE ::cMsg := cValToChar( cMsg ), If( IsWindowVisible( ::oMsgBar:hWnd ), ::Paint(),)

gracias! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
funciona .. pero
Posted: Thu Oct 13, 2011 09:48 PM
Maestro Antonio:

Gracias por responder.

Modifique el c贸digo, y resuelve el problema de las TMsgIte:SetText().

Sin embargo algo pasa con las opciones NOINSET KEYBOARD TIME de TMsgbar



El problema ocurre cuando se crea un dialogo antes de activar la ventana principal, en mi caso yo activo un dialogo para la captura de los datos del usuario: ID, Psw, etc. y si esta Ok, reci茅n activo la ventana principal.

El codigo modificado de Testmbar es:
Code (fw): Select all Collapse
// Testing Bitmaps in the MsgBar

#include "FiveWin.ch"

static oWnd

//----------------------------------------------------------------------------//

function Main()

聽 聽local lMail := .t., oBar

聽 聽local oMsgItem, oMsgItemMail

聽 聽DEFINE WINDOW oWnd TITLE "Testing MsgBar with bitmaps"

聽 聽DEFINE BUTTONBAR oBar OF oWnd _3D

聽 聽@ 10,10 CHECKBOX lMail PROMPT "E-Mail" 聽OF oWnd ;
聽 聽 聽 聽 聽 聽SIZE 200, 35 COLOR CLR_BLACK ;
聽 聽 聽 聽 聽 聽ON CHANGE If( ! lMail, oWnd:oMsgBar:DelItem( oMsgItemMail ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oWnd:oMsgBar:InsItem( oMsgItemMail, 2 ) )

聽 聽SET MESSAGE OF oWnd TO "I may use different bitmaps" 2007

聽 聽DEFINE MSGITEM oMsgItem OF oWnd:oMsgBar ;
聽 聽 聽 聽 聽 PROMPT "Lock" ;
聽 聽 聽 聽 聽 SIZE 60 ;
聽 聽 聽 聽 聽 BITMAPS "..\bitmaps\16x16\lock.bmp", "..\bitmaps\16x16\unlock.bmp" ;
聽 聽 聽 聽 聽 ACTION ( oMsgItem:lActive := !oMsgItem:lActive, oMsgItem:Paint() )

聽 聽DEFINE MSGITEM oMsgItemMail OF oWnd:oMsgBar ;
聽 聽 聽 聽 聽 SIZE 24 ;
聽 聽 聽 聽 聽 BITMAPS "..\bitmaps\16x16\MAIL.BMP" ;
聽 聽 聽 聽 聽 TOOLTIP "Check the email" + CRLF + "Get email"

聽 聽DEFINE MSGITEM OF oWnd:oMsgBar ;
聽 聽 聽 聽 聽 BITMAPS "..\bitmaps\16x16\PRINTER.BMP" ;
聽 聽 聽 聽 聽 ACTION PrinterSetup() ;
聽 聽 聽 聽 聽 TOOLTIP "Setup the printer"

聽 聽oWnd:oMsgBar:DateOn()
聽 聽oWnd:oMsgBar:ClockOn()

聽 聽msginfo( "Antes de activar la ventana" ) 聽//A帽adi esto para crear un dialogo antes de activar la ventana

聽 聽oMsgItem:SetText("Bloqueo") 聽 //<--- ACA EL PROBLEMA!!!!!!!!!!!!!!!!!!

聽 聽ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//


Nuevamente gracias por responder.

Recibe un cordial saludo desde Cochabamba, Bolivia.

Rolando.
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
Re: Creo que tengo la solucion
Posted: Fri Oct 14, 2011 12:39 AM
Master Antonio:

Siguiendo la l贸gica del c贸digo que me indicaste, entonces en el m茅todo ::Refresh() se tiene que reemplazar la llamada a ::Paint() por:

Code (fw): Select all Collapse
If( IsWindowVisible( ::oMsgBar:hWnd ), ::Paint(),)


As铆 lo hice y funciono.

Saludos desde Cochabamba - Bolivia.

Rolando.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TMsgBar: Ayuda por favor.... RESUELTO!!!
Posted: Fri Oct 14, 2011 05:54 AM

Rolando,

Muy bien! Gracias! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1078
Joined: Thu Sep 27, 2007 03:47 PM
Re: TMsgBar: Ayuda por favor.... RESUELTO!!!
Posted: Thu Oct 27, 2011 04:35 PM

Rolando Gracias.

Hice el cambio que indica Lineares.

METHOD SetText( cMsg ) INLINE ::cMsg := cValToChar( cMsg ), If( IsWindowVisible( ::oMsgBar:hWnd ), ::Paint(),)

Pero solamente Pinta el Num los demas como la fecha , Hora , Ins y Caps quedan igual.

Saludos

Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com

Continue the discussion