get read only

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

get read only

Post by Silvio.Falconi »

Can I change on line the readonly of a get when a combo selection change ? ?

Image

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

#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 ???????
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
sreerajklm
Posts: 5
Joined: Tue Sep 23, 2014 5:22 am
Location: Kochi, India

Re: get read only

Post by sreerajklm »

Pls try this.

Code: Select all

#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
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: get read only

Post by artu01 »

Silvio:
Try this

Code: Select all

   @  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: Select all

   @ 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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: get read only

Post by Silvio.Falconi »

I resolved thnks
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply