appear get and say

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

appear get and say

Post by Silvio.Falconi »

I would like when the user selects the Radio control some get and say controls should appear
It seems like an easy thing but in reality it is not


when nradio is 1 they must be displayed
oSay[1] and aGet[3]
when nradio is 2 they must be displayed
oSay[2] and aGet[4]
and before oSay[4] oSay[3 ] and aGet[3] must be displayed
and therefore oSay[4] and aGet[6] must be moved one line i.e. down

in practice without radio =1

Image




if nradio =2

Image

How I can resolve ?

Code: Select all | Expand

#include "fivewin.ch"
#include 'constant.ch'

Function test()
   local oDlgEdit,oFont,oBold

local aGet:= array(10)
local oSay:= array(10)
local nRow:= 0,nCol:= 10
local nInterlinea := 30
 local nSizeHGet:=24
local cget1:= space(20)
local cget2:= space(20)
local cget3:= space(20)
local cget4:= space(20)
local nRadio:= 1

local nBottom:= 20
local nRight := 50
local nHt       := nBottom * DLG_CHARPIX_H
local nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12  BOLD

DEFINE DIALOG oDlgEdit SIZE nWd, nHt PIXEL TRUEPIXEL;
   TITLE "test" FONT oFont COLOR CLR_BLACK, CLR_WHITE;
   STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
              WS_MINIMIZEBOX, WS_THICKFRAME )




   @  nRow, 10 RADIO aGet[2] VAR nRadio Prompt "Tipo 1"  OF oDlgEdit  PIXEL SIZE 80, 25;
   ON CHANGE ChangeDlg(nRadio, oSay,aGet)
   @  nRow, 100 RADIOITEM "Tipo 2"     RADIOMENU aGet[2]  OF oDlgEdit  PIXEL SIZE 80, 25
   @  nRow, 200 RADIOITEM "tipo 3"     RADIOMENU aGet[2]  OF oDlgEdit  PIXEL SIZE 80, 25
   @  nRow, 300 RADIOITEM "tipo 4  "   RADIOMENU aGet[2]  OF oDlgEdit  PIXEL SIZE 80, 25
   nRow+=nInterlinea
   @  nRow,nCol SAY oSay[1] PROMPT  "Deno" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
   @  nRow,nCol SAY oSay[2] PROMPT  "Cogn" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
   nRow-=2
   @  nRow,150 GET aGet[3] VAR cget1 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit
   @  nRow,150 GET aGet[4] VAR cget2 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit

 *  IF nRadio=2
   nRow+=nInterlinea
   @  nRow,nCol SAY oSay[3] PROMPT  "Nome" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
    nRow-=2
   @  nRow,150 GET aGet[5] VAR cget3 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit
  * endif

   nRow+=nInterlinea
    @  nRow,nCol SAY oSay[4] PROMPT  "Address" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
    nRow-=2
   @  nRow,150 GET aGet[6] VAR cget4 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit



   Activate dialog oDlgEdit center ;
   ON INIT aGet[2]:aItems[ nRadio ]:Check()
Return nil



Function ChangeDlg(nRadio,oSay,aGet)
Do case
Case nRadio=1
   oSay[1]:show()
   oSay[2]:Hide()
   oSay[3]:Hide()

   aGet[3]:show()
   aGet[4]:Hide()

   aGet[5]:Hide()

Case nRadio=2
   oSay[1]:Hide()
   oSay[2]:show()
   oSay[3]:show()

   aGet[3]:hide()
   aGet[4]:show()
   aGet[5]:show()

Endcase
return nil

 
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: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: appear get and say

Post by Silvio.Falconi »

another test

Image


I don't understand why that extra line is formed at the last get ????

Code: Select all | Expand

#include "fivewin.ch"
#include 'constant.ch'

Function test()
   local oDlgEdit,oFont,oBold

local aGet:= array(10)
local oSay:= array(10)
local nRow:= 0,nCol:= 10
local nInterlinea := 30
 local nSizeHGet:=24
local cget1:= space(20)
local cget2:= space(20)
local cget3:= space(20)
local cget4:= space(20)
local cget5:= space(20)
local cget6:= space(20)
local nRadio:= 2

local nBottom:= 20
local nRight := 50
local nHt       := nBottom * DLG_CHARPIX_H
local nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12  BOLD

DEFINE DIALOG oDlgEdit SIZE nWd, nHt PIXEL TRUEPIXEL;
   TITLE "test" FONT oFont COLOR CLR_BLACK, CLR_WHITE;
   STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
              WS_MINIMIZEBOX, WS_THICKFRAME )




   @  nRow, 10 RADIO aGet[2] VAR nRadio Prompt "Tipo 1"  OF oDlgEdit  PIXEL SIZE 80, 25;
   ON CHANGE ChangeDlg(nRadio, oSay,aGet,oDlgEdit)
   @  nRow, 100 RADIOITEM "Tipo 2"     RADIOMENU aGet[2]  OF oDlgEdit  PIXEL SIZE 80, 25
   @  nRow, 200 RADIOITEM "tipo 3"     RADIOMENU aGet[2]  OF oDlgEdit  PIXEL SIZE 80, 25
   @  nRow, 300 RADIOITEM "tipo 4  "   RADIOMENU aGet[2]  OF oDlgEdit  PIXEL SIZE 80, 25
   nRow+=nInterlinea

   @  nRow,nCol SAY oSay[3] PROMPT  "Deno" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
   @  nRow,nCol SAY oSay[4] PROMPT  "Cogn" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
   nRow-=2
   @  nRow,150 GET aGet[3] VAR cget1 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit
   @  nRow,150 GET aGet[4] VAR cget2 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit

 *  IF nRadio=2
   nRow+=nInterlinea
   @  nRow,nCol SAY oSay[5] PROMPT  "Nome" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
    nRow-=2
   @  nRow,150 GET aGet[5] VAR cget3 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit
  * endif

   nRow+=nInterlinea
    @  nRow,nCol SAY oSay[6] PROMPT  "Indir" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
    nRow-=2
   @  nRow,150 GET aGet[6] VAR cget4 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit     UPDATE

    nRow+=nInterlinea
    @  nRow,nCol SAY oSay[7] PROMPT  "cap" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
    nRow-=2
    @  nRow,150 GET aGet[7] VAR cget5 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit    UPDATE

     nRow+=nInterlinea
    @  nRow,nCol SAY oSay[8] PROMPT  "Naz" SIZE 100,25  PIXEL OF oDlgEdit TRANSPARENT FONT oFont
    nRow-=2
    @  nRow,150 GET aGet[8] VAR cget6 SIZE  oDlgEdit:nWidth-160,nSizeHGet PIXEL OF   oDlgEdit  UPDATE




      oDlgEdit:bResized  := <||
           local oRect        := oDlgEdit:GetCliRect()

           If nRadio=1  .or.  nRadio=3  .or.  nRadio=4
                oSay[3]:show()
                aGet[3]:show()
                oSay[4]:Hide()
                oSay[5]:Hide()
                aGet[4]:Hide()
                aGet[5]:Hide()

              oSay[6]:ntop := oRect:nTop+60
              aGet[6]:ntop := oRect:nTop+60
              oSay[7]:ntop := oRect:nTop+90
              aGet[7]:ntop := oRect:nTop+90

              oSay[8]:ntop := oRect:nTop+120
              aGet[8]:ntop := oRect:nTop+120

           else

              oSay[3]:Hide()
              aGet[3]:Hide()
              oSay[4]:show()
              oSay[5]:show()
              aGet[4]:show()
              aGet[5]:show()

              oSay[6]:nTop := oRect:nTop+85
              aGet[6]:ntop := oRect:nTop+85
              oSay[7]:ntop := oRect:nTop+115
              aGet[7]:ntop := oRect:nTop+115
              oSay[8]:ntop := oRect:nTop+145
              aGet[8]:ntop := oRect:nTop+145

           endif

                  return nil
               >

   Activate dialog oDlgEdit center ;
   ON INIT ( oDlgEdit :resize(),;
   aGet[2]:aItems[ nRadio ]:Check() )
Return nil



Function ChangeDlg(nRadio,oSay,aGet,oDlgEdit)
Do case
Case nRadio=1
   oSay[3]:show()
   aGet[3]:show()


   oSay[4]:Hide()
   oSay[5]:Hide()
   aGet[4]:Hide()
   aGet[5]:Hide()

Case nRadio=2

   oSay[3]:Hide()
   aGet[3]:Hide()


   oSay[4]:show()
   oSay[5]:show()
   aGet[4]:show()
   aGet[5]:show()

Endcase
eval( oDlgEdit:bResized)
return nil

 
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
Marcelo Via Giglio
Posts: 1071
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: appear get and say

Post by Marcelo Via Giglio »

Hi,

use Tpanel with the controls inside, then hide and show the panel associated with the radio this is more flexible
saludos

Marcelo
User avatar
Silvio.Falconi
Posts: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: appear get and say

Post by Silvio.Falconi »

RESOLVED!! with bresized
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
Post Reply