FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problems with msgbar
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Problems with msgbar
Posted: Mon Jan 21, 2013 09: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Problems with msgbar
Posted: Mon Jan 21, 2013 09:14 AM
Franklin Demont wrote:::aItems[6]:nClrText(CLR_WHITE)
::aItems[6]:nClrPane(CLR_HRED)


Try

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


EMG
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Problems with msgbar
Posted: Mon Jan 21, 2013 09:31 AM
Enrico Maria Giordano wrote:
Franklin Demont wrote:::aItems[6]:nClrText(CLR_WHITE)
::aItems[6]:nClrPane(CLR_HRED)


Try

Code (fw): Select all Collapse
::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 :
::aItems[6]:nClrText := CLR_WHITE
::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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Problems with msgbar
Posted: Mon Jan 21, 2013 09: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 (fw): Select all Collapse
oMsg:Refresh()


It works for me.

EMG
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Problems with msgbar
Posted: Mon Jan 21, 2013 09: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 (fw): Select all Collapse
oMsg:Refresh()


It works for me.

EMG


oMsg:refresh() doesn't change background color
test
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Problems with msgbar
Posted: 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
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Problems with msgbar
Posted: 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problems with msgbar
Posted: Mon Jan 21, 2013 12:56 PM
Frank,

This example is working fine:

frank.prg
Code (fw): Select all Collapse
#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problems with msgbar
Posted: Mon Jan 21, 2013 01:02 PM
And here is a new Method SetColor() for the Class TMsgItem:

Code (fw): Select all Collapse
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 (fw): Select all Collapse
   ACTIVATE WINDOW oWnd ;
      ON CLICK oItem:SetColor( "W+/B" )


or

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

Antonio Linares
www.fivetechsoft.com
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Problems with msgbar (background color) : solved
Posted: Tue Jan 22, 2013 09: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
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Method SetColor() for the Class TMsgItem:
Posted: Tue Jan 22, 2013 10:12 AM
Antonio ,
May i sugest next code ?

Code (fw): Select all Collapse
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problems with msgbar
Posted: Tue Jan 22, 2013 02: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

Continue the discussion