FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Get\Action .. disable the field only
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Get\Action .. disable the field only
Posted: Tue Apr 14, 2020 03:08 PM
To All

I have a Get\action statement that I add a bitmap to that allows me to click on the bitmap ( button magnifying glass ) within the field to fire off the code below. Everything works great but is there a way to disable the field so no one can enter in any data .. I just want the field to be read only .. be able to click the ( active ) button to run my Action routine and fill in the value back into the disabled field ..



In the image above, I want to disable that field but still be able to click the button than send a value back to the disabled field and refresh the results.

Code (fw): Select all Collapse
REDEFINE GET oBreakC   VAR nBreakC         ID 133 of oGRPS PICTURE "999.99" BITMAP "find";
      ACTION ( _RateSlct( cMode,oFontB,"BUTTON",cInstate,cOutState,1,;
                          @nBreakC,oBreakC,@nLunchC,oLunchC,@nDinnerC,oDinnerC,@nMRate,oMRate),;
                         _Exp(  @nBreak,  @nBreakC,  @nBreakT,oBreakT, ;
                         @nLunch,  @nLunchC,  @nLunchT,  oLunchT, ;
                         @nDinner, @nDinnerC, @nDinnerT, oDinnerT, ;
                         @nTmeals, oTmeals,   @nTotalExp,oTotalExp,;
                         @nTHotel, @nTMileage,@nTRegist, @nTAirFare,;
                         @nTMisc,  @nNights,  @nHcost,   oTHotel,;
                         @nMiles,  @nMrate, oTmileage,;
                         oLunch:SetFocus(),oLunch:oJump := oLunch ) ) UPDATE
       oBreakC:lAdjustBtn := .t.


Thanks
Rick Lipkin
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: Get\Action .. disable the field only
Posted: Tue Apr 14, 2020 04:13 PM

Maybe you can set its lenght to 0?

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Get\Action .. disable the field only
Posted: Tue Apr 14, 2020 04:29 PM

oGet:bGotFocus:={||oGet:aControls[1]:SetFocus()}

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Get\Action .. disable the field only
Posted: Tue Apr 14, 2020 05:09 PM

Make the Get READONLY.
In that case, the user can not enter any text in the Get, but can click the button.

Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Get\Action .. disable the field only
Posted: Tue Apr 14, 2020 05:10 PM
Gentleman

I found the answer ... and yes Rao .. you were correct !!!!!
REDEFINE GET oBreakC   VAR nBreakC         ID 133 of oGRPS PICTURE "999.99" BITMAP "find";
      ACTION ( _RateSlct( cMode,oFontB,"BUTTON",cInstate,cOutState,1,;
                          @nBreakC,oBreakC,@nLunchC,oLunchC,@nDinnerC,oDinnerC,@nMRate,oMRate),;
                         _Exp(  @nBreak,  @nBreakC,  @nBreakT,oBreakT, ;
                         @nLunch,  @nLunchC,  @nLunchT,  oLunchT, ;
                         @nDinner, @nDinnerC, @nDinnerT, oDinnerT, ;
                         @nTmeals, oTmeals,   @nTotalExp,oTotalExp,;
                         @nTHotel, @nTMileage,@nTRegist, @nTAirFare,;
                         @nTMisc,  @nNights,  @nHcost,   oTHotel,;
                         @nMiles,  @nMrate, oTmileage,;
                         oLunch:SetFocus(),oLunch:oJump := oLunch ) ) COLOR CLR_BLACK, 16053492 READONLY
Adding the Readonly clause will disable the field and the button still works and returns the correct value to the readonly field



Thanks
Rick Lipkin
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Get\Action .. disable the field only
Posted: Fri Mar 14, 2025 04:27 AM

Dear All,

I try as this topic but the TGET:VarPut() do not accept the new value assign from ACTION. I use TGET:VarPut() and after use TGET:VarGet(), it return as Original Data before change.

Thanks for any help and suggestion.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Get\Action .. disable the field only
Posted: Fri Mar 14, 2025 08:52 AM
Dear Dutch,

Here you have a working example:
#include "FiveWin.ch"

function Main()

   local oDlg, oGet, cText := "test"

   DEFINE DIALOG oDlg 

   @ 2, 2 GET oGet VAR cText ACTION ( oGet:Enable(), cText := "hello", oGet:Refresh(), oGet:Disable() ) SIZE 80, 20 READONLY

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Get\Action .. disable the field only
Posted: Sat Mar 15, 2025 08:59 AM
Dear Antonio,

I use reuse function to use in ACTION and I prefer to use TGET:VarPut() instead of write value to Variable. I see in TGET classes and modify as below and can use TGET:VarPut() write Value to TGET.
  METHOD VarPut( uVal ) INLINE  If( ValType( ::bSetGet ) == "B", ; // .and. ! ::lReadOnly,; // Remark for use VarPut with READONLY 
                                     Eval( ::bSetGet, uVal ),)
Thank you so much,
Antonio Linares wrote: Dear Dutch,

Here you have a working example:
#include "FiveWin.ch"

function Main()

   local oDlg, oGet, cText := "test"

   DEFINE DIALOG oDlg 

   @ 2, 2 GET oGet VAR cText ACTION ( oGet:Enable(), cText := "hello", oGet:Refresh(), oGet:Disable() ) SIZE 80, 20 READONLY

   ACTIVATE DIALOG oDlg CENTERED

return nil
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Get\Action .. disable the field only
Posted: Sat Mar 15, 2025 09:15 AM
You can do it also this way:
#include "FiveWin.ch"

function Main()

   local oDlg, oGet, cText := "test"

   DEFINE DIALOG oDlg 

   @ 2, 2 GET oGet VAR cText ACTION ( oGet:lReadOnly := .F., oGet:VarPut( "hello" ), oGet:lReadOnly := .T. ) SIZE 80, 20 READONLY

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Get\Action .. disable the field only
Posted: Sat Mar 15, 2025 04:27 PM

Dear Antonio,

Yes, I got it. Thank you so much.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion