FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PROMT on button
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: Wed May 21, 2008 06: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: PROMT on button
Posted: Wed May 21, 2008 08:04 PM
#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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: Wed May 21, 2008 08: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
PROMT on button
Posted: Wed May 21, 2008 08: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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: Wed May 21, 2008 09: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
PROMT on button
Posted: Wed May 21, 2008 09: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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: Wed May 21, 2008 09: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
PROMT on button
Posted: Wed May 21, 2008 09: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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: Wed May 21, 2008 09: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
PROMT on button
Posted: 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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: 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" ) ))

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
PROMT on button
Posted: 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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: Wed May 21, 2008 10:47 PM

Antonio

Thanks a MILLION !!

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
PROMT on button
Posted: Wed May 21, 2008 11:04 PM
Rick,

Here you have a working sample using the Class TBtnBmp:

test.prg
#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
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
}

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
PROMT on button
Posted: 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