FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Disable Bitmap for Get-Action
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Disable Bitmap for Get-Action
Posted: Mon Jun 06, 2016 08:04 PM
To All

I am looking for a way to disable a bitmap for a get-action line when ... specifically :
Code (fw): Select all Collapse
REDEFINE GET oPERMASSN  VAR cPERMASSN  ID 138 of oGRPS PICTURE "@!";
             valid cPERMASSN $ "YN' '" UPDATE

REDEFINE GET oOPERATOR  VAR xOPERATOR  ID 121 of oGRPS PICTURE "@!" UPDATE

REDEFINE GET oPRIMARY  VAR xPRIMARY  ID 122 of oGRPS PICTURE "@!" BITMAP "find" ;  // <-- disable here when not true
            when ( cPERMASSN = 'N' .and. xOPERATOR = "  " );
            Action( LightGreyGrad(), _Drvrget(  xPrimary, cMODE, oPrimary, oRsVEH, "VEHICLES", "PRIMARY", "BUTTON", oFontB ),;
                            GreenBlueGrad(),oContact:SetFocus(),oContact:oJump := oContact )
            oPrimary:lAdjustBtn := .t.


Thanks
Rick Lipkin
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 12:34 AM

Rick,

Try:

oPRIMARY:oBtn:bWhen = ...

or

oPRIMARY:oBtn:Disable() (or Enable()) from the WHEN clause

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 03:29 PM
Antonio

Here is my attempt to use your suggestion ..

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Fox\VehSql-MH\Veh32.Exe (32 bits)
   Size: 5,952,512 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150518)
   FiveWin  Version: FWHX 15.04
   Windows version: 6.2, Build 9200 

   Time from start: 0 hours 0 mins 7 secs 
   Error occurred at: 06/07/2016, 11:28:11
   Error description: Error BASE/1005  Class: 'NIL' has no property: BWHEN
   Args:
     [   1] = U   
     [   2] = B   {|| ... }

Stack Calls
===========
   Called from:  => _BWHEN( 0 )
   Called from: VEHVIEW.PRG => _VEHVIEW( 737 )
   Called from: VEHBROW.PRG => (b)_VBROW( 507 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 581 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 815 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1723 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1549 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3355 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1057 )
   Called from: MAIN.PRG => MAIN( 509 )


What I would like to do is use your codeblock and if bWhen is true .. enable otherwise disable at runtime.. Here is my code :
Code (fw): Select all Collapse
REDEFINE GET oPERMASSN  VAR cPERMASSN  ID 138 of oGRPS PICTURE "@!";
             valid cPERMASSN $ "YN' '" UPDATE

REDEFINE GET oOPERATOR  VAR xOPERATOR  ID 121 of oGRPS PICTURE "@!" BITMAP "find" ;
            when ( cPERMASSN = 'Y' .or. xOPERATOR <> "  " );
            Action( LightGreyGrad(), _Drvrget(  xOperator, cMODE, oOperator, oRsVEH, "VEHICLES", "OPERATOR", "BUTTON", oFontB ),;
                            GreenBlueGrad(),oContact:SetFocus(),oContact:oJump := oContact )
            oOperator:lAdjustBtn := .t.

            oOperator:oBtn:bWhen := {| | if( ( cPERMASSN = 'Y' .or. xOPERATOR <> "  " ), oOperator:oBtn:Enable(), oOperator:oBtn:Disable() ) }


Appreciate your help.

Thanks
Rick Lipkin
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 05:43 PM

Rick,

bWhen has to return a logical value:

oOperator:oBtn:bWhen := {| | if( ( cPERMASSN = 'Y' .or. xOPERATOR <> " " ), ( oOperator:oBtn:Enable(), .T. ), ( oOperator:oBtn:Disable(), .F. ) ) }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 06:22 PM
Antonio

I inserted your code and am still getting a similar error :

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Fox\VehSql-MH\Veh32.Exe (32 bits)
   Size: 5,952,512 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150518)
   FiveWin  Version: FWHX 15.04
   Windows version: 6.2, Build 9200 

   Time from start: 0 hours 0 mins 13 secs 
   Error occurred at: 06/07/2016, 14:19:18
   Error description: Error BASE/1005  Class: 'NIL' has no property: BWHEN
   Args:
     [   1] = U   
     [   2] = B   {|| ... }

Stack Calls
===========
   Called from:  => _BWHEN( 0 )
   Called from: VEHVIEW.PRG => _VEHVIEW( 737 )
   Called from: VEHBROW.PRG => (b)_VBROW( 507 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 581 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 815 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1723 )
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1549 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3355 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1057 )
   Called from: MAIN.PRG => MAIN( 509 )


Code (fw): Select all Collapse
REDEFINE GET oPERMASSN  VAR cPERMASSN  ID 138 of oGRPS PICTURE "@!";
             valid cPERMASSN $ "YN' '" UPDATE

REDEFINE GET oOPERATOR  VAR xOPERATOR  ID 121 of oGRPS PICTURE "@!" BITMAP "find" ;
            when ( cPERMASSN = 'Y' .or. xOPERATOR <> "  " );
            Action( LightGreyGrad(), _Drvrget(  xOperator, cMODE, oOperator, oRsVEH, "VEHICLES", "OPERATOR", "BUTTON", oFontB ),;
                            GreenBlueGrad(),oContact:SetFocus(),oContact:oJump := oContact )
            oOperator:lAdjustBtn := .t.

            oOperator:oBtn:bWhen := {| | if( ( cPERMASSN = 'Y' .or. xOPERATOR <> " " ), ( oOperator:oBtn:Enable(), .T. ), ( oOperator:oBtn:Disable(), .F. ) ) }
         *   oOperator:oBtn:bWhen := {| | if( ( cPERMASSN = 'Y' .or. xOPERATOR <> "  " ), oOperator:oBtn:Enable(), oOperator:oBtn:Disable() ) }


Thanks
Rick Lipkin
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 07:47 PM

Rick,

The button may not be created yet.

Please call your code from the ON INIT clause of the dialog

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 09:08 PM
Antonio .. I have made the code suggestion to insert the code in ON INIT and I no longer get a run-time .. as before the Get is read only and you can not navigate into the field .. but the Bitmap graphic has not changed it's appearance ..
Code (fw): Select all Collapse
 ACTIVATE DIALOG oGRPS ;
   ON INIT ( oOperator:oBtn:bWhen := {| | if( ( cPERMASSN = 'Y' .or. xOPERATOR <> " " ), ;
           ( oOperator:oBtn:Enable(), .T. ), ( oOperator:oBtn:Disable(), .F. )) }) ;
   ON PAINT (PalBmpDraw( hDC, 0, 0, oBmp:hBitmap ));
   VALID (!GETKEYSTATE( 27 ))  // do not allow esc key here




Thanks, Rick
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Disable Bitmap for Get-Action
Posted: Tue Jun 07, 2016 09:32 PM

Rick,

Try to repaint it:

( oOperator:oBtn:Disable(), oOperator:oBtn:Refresh(), .F. )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Disable Bitmap for Get-Action
Posted: Wed Jun 08, 2016 12:32 PM

Antonio

Instead of disable .. is there just a way to :Hide() .. I have inserted the Hide method in my code instead of Disable() and still 'no joy' .. If you can think of a way to :Hide() when .f. and Show() when .t. and do it without ON Init .. that would be wonderful.

Thanks
Rick Lipkin

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Disable Bitmap for Get-Action
Posted: Thu Jun 09, 2016 09:18 AM

Rick,

You may use the oGet:bGotFocus to check the WHEN and Hide or not the oBtn accordingly

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion