Problems with msgbar

Problems with msgbar

Postby Franklin Demont » Mon Jan 21, 2013 9:04 am

Hello,

I try to use the messagebar from a MDICHILD window (xbrdbu)

CODE: SELECT ALL EXPAND VIEW

....
DEFINE MSGITEM aItem[4] OF oMsgBar PROMPT IIF(Deleted(),"Deleted","") SIZE 80 COLOR CLR_HRED,CLR_HBLUE
.....
oBrw:bChange := {||aItem[4]:Settext(IIF(Deleted(),"Deleted","")),aItem[4]:Refresh()}



1) The refresh() item from bchange generates a windows error (ends the program , no error log)

2) Background color doesn't change

I tryed also with

::oWnd:oMsgBar:aItems[6]:nClrText(CLR_WHITE)
::oWnd:oMsgBar:aItems[6]:nClrPane(CLR_HRED)
::oWnd:oMsgBar:aItems[6]:SetText("Exclusive")
::oWnd:oMsgBar:aItems[6]:Refresh()

Colors doesn't change


Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Problems with msgbar

Postby Enrico Maria Giordano » Mon Jan 21, 2013 9:14 am

Franklin Demont wrote:::oWnd:oMsgBar:aItems[6]:nClrText(CLR_WHITE)
::oWnd:oMsgBar:aItems[6]:nClrPane(CLR_HRED)


Try

Code: Select all  Expand view
::oWnd:oMsgBar:aItems[6]:SetColor(CLR_WHITE,CLR_HRED)


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with msgbar

Postby Franklin Demont » Mon Jan 21, 2013 9:31 am

Enrico Maria Giordano wrote:
Franklin Demont wrote:::oWnd:oMsgBar:aItems[6]:nClrText(CLR_WHITE)
::oWnd:oMsgBar:aItems[6]:nClrPane(CLR_HRED)


Try

Code: Select all  Expand view
::oWnd:oMsgBar:aItems[6]:SetColor(CLR_WHITE,CLR_HRED)


EMG


Enrico ,

Thanks for the sugestion , but tMsgBar has no method setcolor.

I made a mistake , it must be :
::oWnd:oMsgBar:aItems[6]:nClrText := CLR_WHITE
::oWnd:oMsgBar:aItems[6]:nClrPane := CLR_HRED
Anyway the back ground color doesn't change

The windows error is gone away after discarding DATE KEYBOARD from Defining the messagebar

Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Problems with msgbar

Postby Enrico Maria Giordano » Mon Jan 21, 2013 9:38 am

Franklin Demont wrote:Thanks for the sugestion , but tMsgBar has no method setcolor.


Ops, right, TMsgItem class has no SetColor() method (TMsgBar has it as it inherits from TControl). Try to add

Code: Select all  Expand view
oMsg:Refresh()


It works for me.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with msgbar

Postby Franklin Demont » Mon Jan 21, 2013 9:45 am

Enrico Maria Giordano wrote:
Franklin Demont wrote:Thanks for the sugestion , but tMsgBar has no method setcolor.


Ops, right, TMsgItem class has no SetColor() method (TMsgBar has it as it inherits from TControl). Try to add

Code: Select all  Expand view
oMsg:Refresh()


It works for me.

EMG


oMsg:refresh() doesn't change background color
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Problems with msgbar

Postby Enrico Maria Giordano » Mon Jan 21, 2013 10:00 am

Franklin Demont wrote:oMsg:refresh() doesn't change background color


Please build a reduced and self-contained sample that I can compile and run here.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with msgbar

Postby Franklin Demont » Mon Jan 21, 2013 10:22 am

Enrico Maria Giordano wrote:
Franklin Demont wrote:oMsg:refresh() doesn't change background color


Please build a reduced and self-contained sample that I can compile and run here.

EMG


I work on xbrdbu ( fivewin contributions xbrdbu.zop 29/8/2011) , also in samples from fwh

In file2brw i have :

DEFINE MSGITEM aItem[3] OF oMsgBar PROMPT STR(Recno(),6) + "/" + STR(Reccount(),6) SIZE 80 COLOR CLR_HRED ,CLR_HBLUE

i can't change the background color

Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Problems with msgbar

Postby Antonio Linares » Mon Jan 21, 2013 12:56 pm

Frank,

This example is working fine:

frank.prg
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oWnd, oMsgBar, oItem

   DEFINE WINDOW oWnd
   
   DEFINE MSGBAR oMsgBar OF oWnd NOINSET

   DEFINE MSGITEM oItem OF oMsgBar PROMPT "Item"

   ACTIVATE WINDOW oWnd ;
      ON CLICK ( oItem:nClrPane := CLR_BLUE, oItem:nClrText := CLR_WHITE, oMsgBar:Refresh() )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problems with msgbar

Postby Antonio Linares » Mon Jan 21, 2013 1:02 pm

And here is a new Method SetColor() for the Class TMsgItem:

Code: Select all  Expand view
METHOD SetColor( nClrText, nClrPane ) CLASS TMsgItem

   if ValType( nClrText ) == "N"
      ::nClrText = nClrText
   endif  

   if ValType( nClrPane ) == "N"
      ::nClrPane = nClrPane
   endif  
         
   if ValType( nClrText ) == "C"
      ::nClrText = nGetForeRGB( nClrText )
      ::nClrPane = nGetBackRGB( nClrPane )
   endif
   
   ::oMsgBar:Refresh()
   
return nil      
 


So now we can simplify the previous example like this:

Code: Select all  Expand view
  ACTIVATE WINDOW oWnd ;
      ON CLICK oItem:SetColor( "W+/B" )


or

Code: Select all  Expand view
  ACTIVATE WINDOW oWnd ;
      ON CLICK oItem:SetColor( CLR_WHITE, CLR_BLUE )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problems with msgbar (background color) : solved

Postby Franklin Demont » Tue Jan 22, 2013 9:32 am

Antonio ,

Disabling 2007 clausule solved the problem

On xbrdbu i have now new modules for :

Index management

Utilties
Append from
Copy to
Delete
Recall
Replace
Pack
Zap

Next days also other items from utilities will be ready

Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Method SetColor() for the Class TMsgItem:

Postby Franklin Demont » Tue Jan 22, 2013 10:12 am

Antonio ,
May i sugest next code ?

Code: Select all  Expand view


Method SetColor( nClrText, nClrPane ) CLASS TMsgItem
   //local self := HB_QSelf() method defined with __objaddmethod
   local MemColor := {::nClrText, ::nClrPane }
     if PCOUNT() == 1 .AND. Valtype(nClrText) == "A"
        IF LEN(nClrText) == 2
            nClrPane := nClrText[2]
            nClrText := nClrText[1]
        END
     END
   if ValType( nClrText ) == "N"
      ::nClrText = nClrText
   endif  

   if ValType( nClrPane ) == "N"
      ::nClrPane = nClrPane
   endif  
         
   if ValType( nClrText ) == "C"
      ::nClrText = nGetForeRGB( nClrText )
      ::nClrPane = nGetBackRGB( nClrPane )
   endif
   
   ::oMsgBar:Refresh()
   
return MemColor      
 


The original colors can be restored when necessary

Frank
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Problems with msgbar

Postby Antonio Linares » Tue Jan 22, 2013 2:29 pm

Frank,

That behavior would not being coherent with current FWH SetColor() methods.

What I mean is: all Method SetColor() should behave the same way :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 60 guests