ReadOnly Clause does not respect Color on Get or Say

ReadOnly Clause does not respect Color on Get or Say

Postby Rick Lipkin » Thu Feb 16, 2012 6:54 pm

To All

With FWH 1201 .. I have noticed that using the READONLY clause on a Get or Say does not respect the COLOR attributes in this case using a resource .. I did not try by code.

Rick Lipkin

Consider this Sample

Code: Select all  Expand view

// ReqView.prg
//
//

#INCLUDE "FIVEWIN.CH"

STATIC oEntryBy,oEntryDate
STATIC cEntryBy,dEntryDate
STATIC oStock,cStock,oReq

//-------------------------------
FUNC Main()

LOCAL SAYING,cTITLE,lOK1,oBUTT1,oBUTT2
LOCAL nYear

SET DELETED on
SET CENTURY on
SET 3DLOOK on

nYEAR := ( year( DATE() )-30 )
SET EPOCH to ( nYEAR )

// global gradient
SetDlgGradient( { { .50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } } )


lOK    := .F.

cEntryBy          := "USER    "
dEntryDate        := Date()
cStock            := "12345"

cTITLE := "Parts Request Information      EDIT"


DEFINE DIALOG oREQ RESOURCE "REQVIEW" ;
       TITLE cTITLE

   // non tab stop
   REDEFINE GET oEntryBy   VAR cEntryBy   ID 141 of oREQ COLOR CLR_WHITE, CLR_BLUE READONLY
   REDEFINE Say oEntryDate VAR dEntryDate ID 142 of oREQ COLOR "N/W" READONLY

   // tab stop
   REDEFINE GET oStock VAR cStock         ID 113 of oREQ COLOR "N/R" READONLY



REDEFINE BTNBMP oBUTT1 ID 111 of oREQ   ;     // ok
         PROMPT "&Ok      " LEFT 2007;
         ACTION ( oREQ:END() )

REDEFINE BTNBMP oBUTT2 ID 112 of oREQ   ;    // cancel
         PROMPT "&Cancel   " LEFT 2007;
         ACTION ( oREQ:END() )


ACTIVATE DIALOG oREQ centered

RETURN( Nil )

// end

 


.RC

Code: Select all  Expand view

REQVIEW DIALOG 33, 32, 220, 153
STYLE WS_POPUP | WS_CAPTION
FONT 6, "MS Sans Serif"
{
 LTEXT "No Tab Stop", -1, 9, 16, 30, 24
 EDITTEXT 141, 45, 14, 57, 12, ES_AUTOHSCROLL | NOT WS_TABSTOP | WS_BORDER
 EDITTEXT 142, 45, 28, 57, 12, ES_AUTOHSCROLL | NOT WS_TABSTOP | WS_BORDER
 LTEXT "Tab Stop", -1, 9, 67, 26, 24
 EDITTEXT 113, 46, 71, 57, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
 CONTROL "&Ok", 111, "TBtnBmp", 32 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 123, 110, 41, 25
 CONTROL "&Cancel", 112, "TBtnBmp", 32 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 169, 110, 41, 25
 LTEXT "Get Readonly", -1, 110, 15, 55, 9
 LTEXT "Say Readonly", -1, 110, 29, 55, 9
 LTEXT "Get Readonly", -1, 110, 72, 55, 9
}
 


Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Gale FORd » Thu Feb 16, 2012 8:38 pm

Try adding this to the start of your program:

// Setup tget classdata for disable colors and select colors
TGet():lDisColors := .f. // Do Not Use standard disabled colors
// I like to have light blue background on focused gets so next line is un-commented.
// TGet():nClrFocus := 16577214 // use light blue color to use when GET is focused and lClrFocus is .T.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Rick Lipkin » Thu Feb 16, 2012 9:36 pm

Gale

You suggestion worked .. kinda. Looking at FiveWin.ch .. I do not see any changes to the Get and the <color,colors> clause since version 910 where I was able to use "W/B" as a color tag .. With your suggestion I can use CLR_WHITE, CLR_BLUE .. but not "W/B" :(

I did notice all I have to do is put this ( TGet():lDisColors := .f. ) at the very start of my program and it is globally accepted ..

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Antonio Linares » Fri Feb 17, 2012 12:14 am

Rick,

Please try this example:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oGet, cTest := "Hello world"

   TGet():lDisColors = .F.

   DEFINE DIALOG oDlg

   @ 2, 2 GET oGet VAR cTest COLORS "N/R" READONLY
   
   oGet:nClrPaneDis = oGet:nClrPane
   
   @ 3, 10 BUTTON "Ok" ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil
 

In fact we could automatically assign nClrPaneDis from nClrPane if READONLY and lDisColors are used, so there is no need to write:
oGet:nClrPaneDis = oGet:nClrPane
and also there would be no need to declare oGet
regards, saludos

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

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Antonio Linares » Fri Feb 17, 2012 12:23 am

Solved! There was a bug if using Clipper style colors:

In source\classes\tget.prg line 318:

::nClrPaneDis = ::nClrPane // nClrBack

so now the above example can be simplified to this:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, cTest := "Hello world"

   TGet():lDisColors = .F.

   DEFINE DIALOG oDlg

   @ 2, 2 GET cTest COLORS "N/R" READONLY
   
   @ 3, 10 BUTTON "Ok" ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil
 


Thanks Rick for your very valuable feedback! :-)
regards, saludos

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

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Rick Lipkin » Fri Feb 17, 2012 1:37 pm

Antonio

Thank you for your help .. I presume we will still need to add

TGet():lDisColors = .F.

to the top of our applications if we use the READONLY clause with color attributes ?

Many Thanks
Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Antonio Linares » Fri Feb 17, 2012 5:53 pm

I think we can simplify it and avoid it too :-)

I am going to review it again
regards, saludos

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

Re: ReadOnly Clause does not respect Color on Get or Say

Postby Horizon » Fri Feb 17, 2012 7:07 pm

Hi,

Is it work for combobox?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: ReadOnly Clause does not respect Color on Get or Say FWH1202

Postby Rick Lipkin » Wed Mar 07, 2012 8:24 pm

Antonio

Forgive the follow up on this post as I thought the Clipper colors with READONLY was fixed in 1202.

I went back and reviewed your example demonstrating your fix using code :

Code: Select all  Expand view

#include "FiveWin.ch"

function Main()

   local oDlg, cTest := "Hello world"

   TGet():lDisColors = .F.

   DEFINE DIALOG oDlg

   @ 2, 2 GET cTest COLORS "N/R" READONLY
   
   @ 3, 10 BUTTON "Ok" ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil
 


and this works fine in FWH1202 .. unfortunately it does not seem to work with resources .. I added the TGet():lDisColors = .F. in my example using resources with clipper colors and READONLY does not work as expected.

Please review the code and see if there is something I have missed ?

Thanks again
Rick Lipkin

Image

Code: Select all  Expand view

// Main.prg
//
//

#INCLUDE "FIVEWIN.CH"

STATIC oEntryBy,oEntryDate
STATIC cEntryBy,dEntryDate
STATIC oStock,cStock,oReq

//-------------------------------
FUNC Main()

LOCAL SAYING,cTITLE,lOK1,oBUTT1,oBUTT2
LOCAL nYear

SET DELETED on
SET CENTURY on
SET 3DLOOK on

nYEAR := ( year( DATE() )-30 )
SET EPOCH to ( nYEAR )

TGet():lDisColors = .F.   // readonly fix

// global gradient
SetDlgGradient( { { .50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } } )


lOK    := .F.

cEntryBy          := "USER    "
dEntryDate        := Date()
cStock            := "12345"

cTITLE := "Parts Request Information      EDIT"


DEFINE DIALOG oREQ RESOURCE "REQVIEW" ;
       TITLE cTITLE

   // non tab stop
   REDEFINE GET oEntryBy   VAR cEntryBy   ID 141 of oREQ COLOR CLR_WHITE, CLR_BLUE READONLY
   REDEFINE Say oEntryDate VAR dEntryDate ID 142 of oREQ COLOR "N/W" READONLY

   // tab stop
   REDEFINE GET oStock VAR cStock         ID 113 of oREQ COLOR "N/R" READONLY



REDEFINE BTNBMP oBUTT1 ID 111 of oREQ   ;     // ok
         PROMPT "&Ok      " LEFT 2007;
         ACTION ( oREQ:END() )

REDEFINE BTNBMP oBUTT2 ID 112 of oREQ   ;    // cancel
         PROMPT "&Cancel   " LEFT 2007;
         ACTION ( oREQ:END() )


ACTIVATE DIALOG oREQ centered

RETURN( Nil )

// end
 


.rc

Code: Select all  Expand view

REQVIEW DIALOG 33, 32, 220, 153
STYLE WS_POPUP | WS_CAPTION
CAPTION "Clipper colors Readonly with Resource"
FONT 6, "MS Sans Serif"
{
 LTEXT "No Tab Stop", -1, 9, 16, 30, 24
 EDITTEXT 141, 45, 14, 57, 12, ES_AUTOHSCROLL | NOT WS_TABSTOP | WS_BORDER
 EDITTEXT 142, 45, 28, 57, 12, ES_AUTOHSCROLL | NOT WS_TABSTOP | WS_BORDER
 LTEXT "Tab Stop", -1, 9, 67, 26, 24
 EDITTEXT 113, 46, 71, 57, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
 CONTROL "&Ok", 111, "TBtnBmp", 32 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 123, 110, 41, 25
 CONTROL "&Cancel", 112, "TBtnBmp", 32 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 169, 110, 41, 25
 LTEXT "Get Readonly w rgb", -1, 110, 15, 79, 9
 LTEXT "Say Readonly Color w/n", -1, 110, 29, 90, 9
 LTEXT "Get Readonly color n/r", -1, 110, 72, 90, 9
}
 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

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