on Top there is a turllnk ( I need it to protect the modify of reservation)
on Botton of dialog there are btnbmps buttons, these buttons are disabled until the final user press the urlnk..... why ?
if the url lnk is pressed the folder must change the height and the box (where is the turlnk) must be destroyed
Please try this small test
- Code: Select all Expand view RUN
#include "fivewin.ch"
#include "constant.ch"
Function test()
local oDlg,oBrowse,oFolder
local oPanelGray,oPanelScroll,oPanelGreen,oPanelWhite
local oBtnSave,oBtnClose,oBtnoMaggio
local oFont,oFontBold,oLarge
local oBtnPacc
local nSpazio:= 40
Local lModifica:=.f.
Local oProtezione
Local cImgProtetta:=".\bitmaps\Lock.png"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE FONT oFontBold NAME "TAHOMA" SIZE 0,-14 BOLD
DEFINE FONT oLarge NAME "VERDANA" SIZE 0,-20 BOLD
DEFINE DIALOG oDlg TITLE "test " SIZE 1130,650 ;
PIXEL TRUEPIXEL RESIZABLE COLOR CLR_HGRAY ,CLR_WHITE
@ 1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL ;
PROMPT "Reservation","Payments"
oFolder:aEnable = { .t., .f. }
@ 520,680 BTNBMP oBtnSave ;
PROMPT "Save" SIZE 130,60 PIXEL OF oDlg;
RESOURCE "INVOICE_SAVE" FLAT RIGHT;
FONT oFontBold ;
ACTION ( oDlg:end( IDOK ) )
@ 520,780 BTNBMP oBtnClose ;
PROMPT "Chiudi" SIZE 130,60 PIXEL OF oDlg;
RESOURCE "INVOICE_EXIT" FLAT RIGHT;
FONT oFontBold ;
ACTION ( oDlg:end( IDCANCEL ) )
@ 520,680 BTNBMP oBtnoMaggio ;
PROMPT " oMaggio " SIZE 130,60 PIXEL OF oDlg;
RESOURCE "INVOICE_OMAGGIO " FLAT RIGHT;
FONT oFontBold ;
ACTION NIL
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
oFolder:nWidth := oRect:nRight-2
If lModifica
oFolder:ntop := oRect:nTop
oFolder:nHeight := oRect:nBottom-60
oPanelGray:nTop := oRect:nBottom - 130
oPanelGreen:nTop := oRect:ntop +80
oPanelWhite:nTop := oRect:nBottom - 175
oProtezione:end()
else
oFolder:ntop := oRect:nTop+nSpazio
oFolder:nHeight := oRect:nBottom-(60+nSpazio)
oPanelGray:nTop := oRect:nBottom-(130+nSpazio)
oPanelGreen:nTop := oRect:ntop +(80+nSpazio)
oPanelWhite:nTop := oRect:nBottom - (175+nSpazio)
oProtezione:nwidth := oRect:nRight - 2
ENDIF
oPanelGreen:nLeft := oRect:nleft+10
oPanelWhite:nLeft := oRect:nleft+500
oPanelGray:nwidth := oRect:nRight - 18
oPanelGreen:nwidth := oRect:nRight - 18
oPanelWhite:nwidth := oRect:nRight -512
oBtnSave:nLeft := oRect:nRight - 300
oBtnsave:nTop := oRect:nBottom - 60
oBtnClose:nLeft := oRect:nRight - 140
oBtnClose:nTop := oRect:nBottom - 60
oBtnoMaggio:nLeft := oRect:nLeft + 100
oBtnoMaggio:nTop := oRect:nBottom - 60
return nil
>
ACTIVATE DIALOG oDlg CENTERED;
ON INIT (IIf(!lmodifica,(oProtezione:=BoxProtezione(oDlg),;
Setta_Modifica(oProtezione,@lModifica,oDlg,cImgProtetta)),) ,;
oPanelGreen := PanelGreen(oFolder) ,;
oPanelGray := PanelGray(oFolder) ,;
oPanelWhite := PanelWhite(oFolder) ,;
EVAL( oDlg:bResized) )
IF oDlg:nresult == IDOK
msginfo("yes")
Endif
return nil
RETURN NIL
//--------------------------------------------------------------------------------//
Function Setta_Modifica(oPanelProtect,lModifica,oDlg,cImgProtetta)
Local oFnt
Local nRow:= 2
Local cText:= "Prenotazione protetta da modifica -"
IF !lModifica
DEFINE FONT oFnt NAME "Arial" SIZE 0,-10
oPanelProtect:bPainted := { || ( oPanelProtect:Box( 1,1,oPanelProtect:nHeight-1,oPanelProtect:nWidth-1),;
FW_DrawImage( oPanelProtect, cImgProtetta,{ 5,9,25,26} , .t.,,,.f.,"LEFT", ),;
oPanelProtect:Say( nRow+6, 44, cText, CLR_BLUE, , oFnt, .t.,.T., ),;
UrlAction(@lModifica,oDlg,oFnt,nRow+6,213,oPanelProtect)) }
Endif
return lModifica
//-----------------------------------------------------------//
Function UrlAction(lModifica,oDlg,oFont,nRow,nCol,oPanel)
Local oUrlLink
IF !lModifica
oUrlLink := TUrlLink():New(nRow, nCol,oPanel , .T., .F., oFont, "", "("+"Sblocca"+")" )
oUrlLink:SetColor( oUrlLink:nClrText, oUrlLink:nClrPane )
oUrlLink:nClrOver = CLR_RED
oUrlLink:bAction = { || lModifica := !lModifica, EVAL( oDlg:bResized) }
Endif
return lModifica
//-----------------------------------------------------------//
function PanelGreen(oFld)
local oPanel,oBrushGreen
Local aGradgreen := { Rgb( 225,239,219),Rgb( 225,239,219)}
DEFINE BRUSH oBrushGreen GRADIENT aGradgreen
oPanel:=Tpanel():New( 35, 5, 75, oFld:aDialogs[1]:nWidth-5, oFld:aDialogs[1])
oPanel:SetBrush( oBrushGreen )
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
return oPanel
//--------------------------------------------------------------//
function PanelGray(oFld)
local oPanel,oBrushGray
Local aGradgray := { nRgb(211,211,211),nRgb(211,211,211)}
DEFINE BRUSH oBrushGray GRADIENT aGradgray
oPanel:=Tpanel():New( 35, 5, 75, oFld:aDialogs[1]:nWidth-5, oFld:aDialogs[1])
oPanel:SetBrush( oBrushGray )
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
return oPanel
//------------------------------------------------------------------//
Static function PanelWhite(oFld)
local oPanel,oBrushWhite
Local aGradWhite := { RGB( 255, 255, 255 ),RGB( 255, 255, 255 )}
DEFINE BRUSH oBrushWhite GRADIENT aGradWhite
oPanel:=Tpanel():New( 35, 5, 75, 200, oFld:aDialogs[1])
oPanel:SetBrush( oBrushWhite )
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
return oPanel
//------------------------------------------------------------------//
function BoxProtezione(oDlg)
local oPanel,oBrushGreen
Local aGradgreen := { Rgb( 225,239,219),Rgb( 225,239,219)}
DEFINE BRUSH oBrushGreen GRADIENT aGradgreen
oPanel:=Tpanel():New( 2, 2, 25, oDlg:nWidth-5, oDlg)
oPanel:SetBrush( oBrushGreen )
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
return oPanel
//------------------------------------------------------------------//
I would need at least to have the obtnclose button active because the end user could not modify the record and close the dialog