get read only

get read only

Postby Silvio.Falconi » Wed Nov 04, 2020 11:34 am

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  Expand view

#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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6896
Joined: Thu Oct 18, 2012 7:17 pm

Re: get read only

Postby sreerajklm » Fri Nov 06, 2020 12:30 pm

Pls try this.

Code: Select all  Expand view
#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
sreerajklm
 
Posts: 6
Joined: Tue Sep 23, 2014 5:22 am
Location: Kochi, India

Re: get read only

Postby artu01 » Mon Nov 09, 2020 1:15 am

Silvio:
Try this

Code: Select all  Expand view

   @  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  Expand view

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

Re: get read only

Postby Silvio.Falconi » Mon Nov 09, 2020 8:10 am

I resolved thnks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6896
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 63 guests