FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour get read only
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
get read only
Posted: Wed Nov 04, 2020 11:34 AM
Can I change on line the readonly of a get when a combo selection change ? ?



I want the get controls to always be readonly except when the selected combo is "Personalizzato"

I tried with this test
but not run on change function

Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg
   local aFormati   :={ "A4","Personalizzato"}
   local nLarghezza  := 21
   local nALtezza    := 29.7 
   local cFormato    :="A4"
   local lOrizontale := .f.

   local aGet[ 4 ]

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL

   @  8,  5 Say "Tipo Pagina " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR cFormato ITEMS aFormati SIZE 50,90 PIXEL OF oDlg;
        ON CHANGE cambiapagina(@nAltezza, @nLarghezza,aget,cFormato,lOrizontale)

   @ 24,  5 Say "Larghezza" SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 GET aGet[2] VAR nLarghezza SIZE 50,12 PIXEL  RIGHT UPDATE OF oDlg //readonly

   @ 44,  5 Say "Altezza" SIZE 80,14 PIXEL OF oDlg
   @ 42, 75 GET aGet[3] VAR nAltezza  SIZE 50,12 PIXEL RIGHT UPDATE OF oDlg //readonly

   @ 54, 75 checkboX aGet[4]  VAR lOrizontale PROMPT "Orizzontale"  SIZE 110,20 PIXEL  UPDATE OF oDlg ;
                 ON CHANGE cambiapagina(@nAltezza, @nLarghezza,aget,cFormato,lOrizontale)

   ACTIVATE DIALOG oDlg CENTERED ;
   on init (aget[2]:lReadOnly :=.t.,;
            aget[3]:lReadOnly :=.t. )
return nil

Function CambiaPagina(nAltezza, nLarghezza,aget,cFormato,lOrizontale)

   IF alltrim(cFormato)="A4"
      IF lOrizontale
            nAltezza   := 29.7
            nLarghezza := 21
         ELSE
           nAltezza   := 21
           nLarghezza := 29.7
       ENDIF
      aget[2]:lReadOnly :=.t.
      aget[3]:lReadOnly :=.t.
   else
      nAltezza   := 0
      nLarghezza := 0
      aget[2]:lReadOnly :=.f.
      aget[3]:lReadOnly :=.f.
   endif

   aget[2]:refresh()
   aget[3]:refresh()

 return nil


it change the value from 29.7 to 30 why ???????
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6
Joined: Tue Sep 23, 2014 05:22 AM
Re: get read only
Posted: Fri Nov 06, 2020 12:30 PM
Pls try this.

Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg
   local aFormati   :={ "A4","Personalizzato"}
   local nLarghezza  := 21
   local nALtezza    := 29.7
   local cFormato    :="A4"
   local lOrizontale := .f.

   local aGet[ 4 ]

   DEFINE DIALOG oDlg SIZE 400,200 PIXEL

   @  8,  5 Say "Tipo Pagina " SIZE 80,14 PIXEL OF oDlg
   @  8, 75 COMBOBOX aGet[1] VAR cFormato ITEMS aFormati SIZE 50,90 PIXEL OF oDlg;
        ON CHANGE cambiapagina(@nAltezza, @nLarghezza,aget,cFormato,lOrizontale)

   @ 24,  5 Say "Larghezza" SIZE 80,14 PIXEL OF oDlg
   @ 22, 75 GET aGet[2] VAR nLarghezza SIZE 50,12 PIXEL  RIGHT UPDATE OF oDlg //readonly

   @ 44,  5 Say "Altezza" SIZE 80,14 PIXEL OF oDlg
   @ 42, 75 GET aGet[3] VAR nAltezza  SIZE 50,12 PIXEL RIGHT UPDATE OF oDlg //readonly

   @ 54, 75 checkboX aGet[4]  VAR lOrizontale PROMPT "Orizzontale"  SIZE 110,20 PIXEL  UPDATE OF oDlg ;
                 ON CHANGE cambiapagina(@nAltezza, @nLarghezza,aget,cFormato,lOrizontale)

   ACTIVATE DIALOG oDlg CENTERED ;
   on init (aget[2]:lReadOnly :=.t.,;
            aget[3]:lReadOnly :=.t. )
return nil

Function CambiaPagina(nAltezza, nLarghezza,aget,cFormato,lOrizontale)

   IF alltrim(cFormato)="A4"
      IF lOrizontale
            nAltezza   := 29.7
            nLarghezza := 21
         ELSE
           nAltezza   := 21
           nLarghezza := 29.7
       ENDIF
      aget[2]:lReadOnly :=.t.
      aget[3]:lReadOnly :=.t.
   else
      nAltezza   := 0.00
      nLarghezza := 0.00
      aget[2]:lReadOnly :=.f.
      aget[3]:lReadOnly :=.f.
   endif

   aget[2]:refresh()
   aget[3]:refresh()

 return nil
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
Re: get read only
Posted: Mon Nov 09, 2020 01:15 AM
Silvio:
Try this

Code (fw): Select all Collapse
   @  8, 75 COMBOBOX aGet[1] VAR cFormato ITEMS aFormati SIZE 50,90 PIXEL OF oDlg;
        ON CHANGE (cambiapagina(@nAltezza, @nLarghezza,aget,cFormato,lOrizontale), oDlg:Update)


Silvio.Falconi wrote:it change the value from 29.7 to 30 why ???????


Code (fw): Select all Collapse
   @ 22, 75 GET aGet[2] VAR nLarghezza SIZE 50,12 PIXEL  RIGHT picture "99.99" UPDATE OF oDlg //readonly
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: get read only
Posted: Mon Nov 09, 2020 08:10 AM

I resolved thnks

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion