Disable Bitmap for Get-Action

Disable Bitmap for Get-Action

Postby Rick Lipkin » Mon Jun 06, 2016 8:04 pm

To All

I am looking for a way to disable a bitmap for a get-action line when ... specifically :
Code: Select all  Expand view


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
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Disable Bitmap for Get-Action

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Disable Bitmap for Get-Action

Postby Rick Lipkin » Tue Jun 07, 2016 3:29 pm

Antonio

Here is my attempt to use your suggestion ..

Code: Select all  Expand view

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: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Disable Bitmap for Get-Action

Postby Antonio Linares » Tue Jun 07, 2016 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Disable Bitmap for Get-Action

Postby Rick Lipkin » Tue Jun 07, 2016 6:22 pm

Antonio

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

Code: Select all  Expand view

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: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Disable Bitmap for Get-Action

Postby Antonio Linares » Tue Jun 07, 2016 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Disable Bitmap for Get-Action

Postby Rick Lipkin » Tue Jun 07, 2016 9: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: Select all  Expand view

 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
 


Image

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

Re: Disable Bitmap for Get-Action

Postby Antonio Linares » Tue Jun 07, 2016 9:32 pm

Rick,

Try to repaint it:

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

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

Re: Disable Bitmap for Get-Action

Postby Rick Lipkin » 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
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Disable Bitmap for Get-Action

Postby Antonio Linares » Thu Jun 09, 2016 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 25 guests