appear get and say
Posted: Mon Jun 03, 2024 10:41 am
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
if nradio =2
How I can resolve ?
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
if nradio =2
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