PROMT on button
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
PROMT on button
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
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
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: PROMT on button
Code: Select all
#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
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
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" ) ))
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" ) ))
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Rick,
Here you have a working sample using the Class TBtnBmp:
test.prg
test.rc
Here you have a working sample using the Class TBtnBmp:
test.prg
Code: Select all
#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
Code: Select all
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
}
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA