PROMT on button

PROMT on button

Postby Rick Lipkin » Wed May 21, 2008 6:45 pm

To All

Sorry for asking a dumb question .. never had to do this before .. based on a logical condition to change the text on the button .. here is the code :

DO CASE
CASE cISCHARTER = .T. // found a charter document
cCHPROMPT := " This Projects CHARTER [read me]"
OTHERWISE
cCHPROMPT := " This Projects CHARTER"
ENDCASE

REDEFINE BUTTON oBTN5 ID 138 PROMPT cCHPROMPT of oWORK ; // charter
ACTION ( _Chimport( oRsProj, cPROJECTEID, cMODE, oWork ))


Application
===========
Path and name: C:\FOX\PMOSQL\PmoW32.Exe (32 bits)
Size: 1,717,248 bytes
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 05/21/2008, 14:31:54
Error description: Error BASE/1004 Message not found: TBUTTON:DEFCONTROL

Stack Calls
===========
Called from: => TBUTTON:ERROR(179)
Called from: tobject.prg => (b)HBOBJECT:HBOBJECT(105)
Called from: => TBUTTON:MSGNOTFOUND(0)
Called from: BUTTON.PRG => TBUTTON:DEFCONTROL(167)
Called from: BUTTON.PRG => TBUTTON:REDEFINE(0)
Called from: PROJVIEW.PRG => _PROJVIEW(350)
Called from: PROJBROW.PRG => (b)_PBROW(200)
Called from: CONTROL.PRG => TCONTROL:LDBLCLICK(0)
Called from: WBROWSE.PRG => TWBROWSE:LDBLCLICK(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TWBROWSE:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: MAIN.PRG => MAIN(234)


Any clues ?? using a rather old version or FiveWin .. fwh27 ..

Rick Lipkin
SC Dept of Health, USA
User avatar
Rick Lipkin
 
Posts: 2663
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: PROMT on button

Postby Enrico Maria Giordano » Wed May 21, 2008 8:04 pm

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oBtn

    DEFINE DIALOG oDlg

    @ 3, 1 BUTTON oBtn;
           PROMPT "&Original";
           ACTION oBtn:SetText( "Changed" )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


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

Postby Rick Lipkin » Wed May 21, 2008 8:24 pm

Enrico

Trying to do this on a redefine .. looking at FiveWin.ch .. 'prompt' is a parameter on the Redefine Button :cry:

I just re-newed my FTDN .. perhaps my old fwh27 has a few 'moths' in it ..

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

Postby Antonio Linares » Wed May 21, 2008 8:52 pm

Rick,

We have just processed your order, thanks!

Try it this way:
REDEFINE BUTTON oBTN5 PROMPT cCHPROMPT ID 138 of oWORK ;
ACTION ( _Chimport( oRsProj, cPROJECTEID, cMODE, oWork ))

It looks as a preprocessor issue with the compiler version that you are using. Check the resulting PPO file
regards, saludos

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

Postby Rick Lipkin » Wed May 21, 2008 9:16 pm

Antonio

HMMMM .. that worked .. just had the PROMPT in the wrong place .. Another question .. I would like to turn the PROMPT ( text ) RED if the logical is .f. .. did not see a COLOR clause Button option .. is this doable ??

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

Postby Antonio Linares » Wed May 21, 2008 9:20 pm

Rick,

Try this:
oButton:SetColor( "R+/W" ) // or use a pair of RGB colors

You may be able to change the text color only
regards, saludos

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

Postby Rick Lipkin » Wed May 21, 2008 9:33 pm

Antonio

Must be doing something wrong .. getting an error that setcolor is NIL

DO CASE
CASE cISCHARTER = .T. // found a charter document
cCHPROMPT := "This Projects CHARTER [read me]"
oBtn5:SetColor( "G+/W" )
OTHERWISE
cCHPROMPT := "This Projects CHARTER"
oBtn5:SetColor( "R+/W" )
ENDCASE

REDEFINE BUTTON oBTN5 PROMPT cCHPROMPT ID 138 of oWORK ;
ACTION ( _Chimport( oRsProj, cPROJECTEID, cMODE, oWork ))

Application
===========
Path and name: C:\FOX\PMOSQL\PmoW32.Exe (32 bits)
Size: 1,718,272 bytes
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 05/21/2008, 17:30:08
Error description: Error BASE/1004 Class: 'NIL' has no exported method: SETCOLOR
Args:
[ 1] = C G+/W

Stack Calls
===========
Called from: => SETCOLOR(0)
Called from: PROJVIEW.PRG => _PROJVIEW(342)
Called from: PROJBROW.PRG => (b)_PBROW(200)
Called from: CONTROL.PRG => TCONTROL:LDBLCLICK(0)
Called from: WBROWSE.PRG => TWBROWSE:LDBLCLICK(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TWBROWSE:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: MAIN.PRG => MAIN(234)

Must be one of my 'stupid' days .. sorry :?

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

Postby Antonio Linares » Wed May 21, 2008 9:37 pm

Rick,

You have to call oBtn:SetColor( ... ) after you REDEFINE it

If you do it before, then oBtn is still nil
regards, saludos

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

Postby Rick Lipkin » Wed May 21, 2008 9:53 pm

Antonio

Did not get an error .. but no change in color for the oBtn5 button ..

DO CASE
CASE cISCHARTER = .T. // found a charter document
cCHPROMPT := "This Projects CHARTER [read me]"+space(12)
OTHERWISE
cCHPROMPT := "This Projects CHARTER"+space(40)
ENDCASE

REDEFINE BUTTON oBTN5 PROMPT cCHPROMPT ID 138 of oWORK ;
ACTION ( _Chimport( oRsProj, cPROJECTEID, cMODE, oWork ))

DO CASE
CASE cISCHARTER = .T. // found a charter document
oBtn5:SetColor( "G+/W" )
oBTN5:ReFresh()
SysReFresh()
OTHERWISE
oBtn5:SetColor( "R+/W" )
oBtn5:ReFresh()
SysReFresh()
ENDCASE

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

Postby Antonio Linares » Wed May 21, 2008 10:09 pm

Rick,

Please try it again from the ON INIT clause of the dialog:

ACTIVATE DIALOG oDlg ;
ON INIT oBtn5:SetColor( "R+/W" )
regards, saludos

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

Postby Rick Lipkin » Wed May 21, 2008 10:29 pm

Antonio

Been one of those days .. just got Sylvia's FTDN renewal notice and I have downloaded the latest FWH .. going to wait til tomorrow to update ..

Unfortunitly .. the ON INIT clause did not change any color on oBtn5 .. did not error .. just did not change the color ..

DO CASE
CASE lISCHARTER = .T. // found a charter document
cCHPROMPT := "This Projects CHARTER [read me]"+space(10)
OTHERWISE
cCHPROMPT := "This Projects CHARTER"+space(40)
ENDCASE

REDEFINE BUTTON oBTN5 PROMPT cCHPROMPT ID 138 of oWORK ;
ACTION ( _Chimport( oRsProj, cPROJECTEID, cMODE, oWork ))

/*
DO CASE
CASE lISCHARTER = .T. // found a charter document
oBtn5:SetColor( "G+/W" )
oBTN5:ReFresh()
SysReFresh()
OTHERWISE
oBtn5:SetColor( "R+/W" )
oBtn5:ReFresh()
SysReFresh()
ENDCASE
*/

REDEFINE BUTTON oBTN6 ID 115 of oWORK // misc documents


ACTIVATE DIALOG oWORK ;
ON INIT( if( cMODE = "V", (oBTN7:Hide(), oBTN8:Hide(), oBtn9:Hide()), ),;
if( lISCHARTER = .T., oBtn5:SetColor( "G+/W" ),oBtn5:SetColor( "R+/W" ) ))
User avatar
Rick Lipkin
 
Posts: 2663
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Wed May 21, 2008 10:44 pm

Rick,

We are going to do some tests here.

You may need to use a TBtnBmp instead of a TButton
regards, saludos

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

Postby Rick Lipkin » Wed May 21, 2008 10:47 pm

Antonio

Thanks a MILLION !!
User avatar
Rick Lipkin
 
Posts: 2663
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Wed May 21, 2008 11:04 pm

Rick,

Here you have a working sample using the Class TBtnBmp:

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

function Main()

   local oDlg, oBtn

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE BTNBMP oBtn PROMPT "A Test" ID 100 OF oDlg ACTION MsgInfo( "Click" )
   
   oBtn:SetColor( "R+/W" )
   
   ACTIVATE DIALOG oDlg CENTERED

return nil


test.rc
Code: Select all  Expand view
test DIALOG 76, 71, 194, 119
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Colors on Buttons"
FONT 8, "MS Sans Serif"
{
CONTROL "A Test", 100, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 62, 50, 22
}

Image
regards, saludos

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

Postby Rick Lipkin » Wed May 21, 2008 11:44 pm

Antonio

Worked like a CHAMP !! .. 8:00 pm here .. time for me to go home !!

Thank you VERY Much

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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