Problem on a Dialog, btns are disabled RESOLVED

Problem on a Dialog, btns are disabled RESOLVED

Postby Silvio.Falconi » Fri Dec 20, 2019 3:07 pm

Image


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
Last edited by Silvio.Falconi on Wed Jan 08, 2020 12:02 pm, edited 2 times in total.
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: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on a Dialog (btnbmp are disabled)

Postby ukoenig » Sat Dec 21, 2019 6:51 pm

Silvio,

just change
oDlg:bResized := <||
to
oDlg:bPainted := <||
and delete in
ON INIT
EVAL( oDlg:bResized)

THE TEST

Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Problem on a Dialog (btnbmp are disabled)

Postby Silvio.Falconi » Mon Dec 23, 2019 9:09 am

ukoenig wrote:Silvio,

just change
oDlg:bResized := <||
to
oDlg:bPainted := <||
and delete in
ON INIT
EVAL( oDlg:bResized)

THE TEST

Image

regards
Uwe :D







Uwe,
it is the same

I add

Code: Select all  Expand view  RUN

  oDlg:bPainted := {|| (EVAL( oDlg:bResized),;
                   IIF( lModifica = .f.,;
                   setta_Modifica(oProtezione,@lModifica,oDlg,cImgProtetta),)  ) }

 




I need to have on init clausole and bResized to resize panels

Code: Select all  Expand view  RUN

ACTIVATE DIALOG oDlg CENTERED;
                     ON INIT (oProtezione:=BoxProtezione(oDlg),;
                              oPanelGreen  := PanelGreen(oFolder)  ,;
                              oPanelGray   := PanelGray(oFolder)   ,;
                              oPanelWhite  := PanelWhite(oFolder) )
                                        


 



I tried but the buttons are disabled the same
the test
Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "constant.ch"

REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO

REQUEST HB_Lang_IT
REQUEST HB_CODEPAGE_ITWIN
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:bPainted := {|| (EVAL( oDlg:bResized),;
                   IIF( lModifica = .f.,;
                   setta_Modifica(oProtezione,@lModifica,oDlg,cImgProtetta),)  ) }




  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
              >

              oDlg:aMinMaxInfo := { nil, nil, ,, 1130,650, , }

              ACTIVATE DIALOG oDlg CENTERED;
                     ON INIT (oProtezione:=BoxProtezione(oDlg),;
                              oPanelGreen  := PanelGreen(oFolder)  ,;
                              oPanelGray   := PanelGray(oFolder)   ,;
                              oPanelWhite  := PanelWhite(oFolder) )





      IF oDlg:nresult == IDOK
         msginfo("yes")
         Endif

 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
//------------------------------------------------------------------//




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

Re: Problem on a Dialog (btnbmp are disabled)

Postby Silvio.Falconi » Tue Jan 07, 2020 5:38 pm

Any solution Please

I also Have the btnbmps disabled
I wish have close btnbmp enable

seem urllink control disabled all
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: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on a Dialog (btnbmp are disabled)

Postby karinha » Tue Jan 07, 2020 6:37 pm

Silvio, teste please:

Code: Select all  Expand view  RUN

   /* // no funciona -> CLR_HGRAY -> Dark mode.
   DEFINE DIALOG oDlg TITLE "test " SIZE 1130, 650 ;
      PIXEL TRUEPIXEL RESIZABLE COLOR CLR_HGRAY , CLR_WHITE
   */


   // funciona
   DEFINE DIALOG oDlg TITLE "test/Silvio" SIZE 1130, 650 ;
      PIXEL TRUEPIXEL RESIZABLE COLORS CLR_BLACK, CLR_WHITE TRANSPARENT
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7842
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Problem on a Dialog (btnbmp are disabled)

Postby Silvio.Falconi » Wed Jan 08, 2020 9:54 am

there is not a question of colors
Please
When the Urllink control is activated you cannot press the buttons
you must press before the url link and the the button are enabled


@ 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 ) )



you can move the mouse over therse buttons but you cannot execute the command of each buttons

If you press "Save" buttons the procedure must execute this

Code: Select all  Expand view  RUN
IF oDlg:nresult == IDOK
               msginfo("yes")
            Endif




Please test this release ( I translate on english my texts)
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.    // init for block the modify

       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 COLORS CLR_BLACK, CLR_WHITE TRANSPARENT //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 "Close"  SIZE 130,60 PIXEL OF oDlg;
                   RESOURCE "INVOICE_EXIT"  FLAT RIGHT;
                    FONT oFontBold  ;
                ACTION  ( oDlg:end( IDCANCEL ) )

                 @ 520,680 BTNBMP oBtnoMaggio ;
                 PROMPT " another btn "  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:= BoxUrllnk(oDlg),;
                       Activate_Modify(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
    //--------------------------------------------------------------------------------//
   // if not lmodifica show a url linkinto oPanel protect

    Function  Activate_Modify(oPanelProtect,lModifica,oDlg,cImgProtetta)
       Local oFnt
       Local nRow:= 2
       Local cText:= "Booking protected from modify"

     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
    //-----------------------------------------------------------//
      // activate a Url link control
    Function UrlAction(lModifica,oDlg,oFont,nRow,nCol,oPanel)
       Local oUrlLink
       IF !lModifica
          oUrlLink := TUrlLink():New(nRow, nCol,oPanel , .T., .F., oFont, "", "("+"Check"+")" )
          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 BoxUrllnk(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 Tried to use bpainted as sad by Uwe but it not run
I Tried also to insert oBtnClose:Enable() when it create the urllnk object but not run also
I tried to substitute a button instead of Urllink as

@ nrow,ncol button oUrlLink Prompt "Sblocca" of oPanel size 20,12 PIXEL
oUrlLink:bAction = { || lModifica := !lModifica, EVAL( oDlg:bResized) }

the btnbmps are disabled also
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: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on a Dialog, btns are disabled with Urlnk object

Postby Silvio.Falconi » Wed Jan 08, 2020 10:55 am

Now I found perhaps the error oPanelProtect:bPainted
If I rem this

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)) }


and insert this

UrlAction(@lModifica,oDlg,oFnt,nRow+6,213,oPanelProtect)

run ok but I need to write a test and show a bitmap on oPanelProtect
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: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem on a Dialog, btns are disabled with Urlnk object

Postby Silvio.Falconi » Wed Jan 08, 2020 12:01 pm

Good I found the error now run ok

IF !lModifica
UrlAction(@lModifica,oDlg,oFnt,nRow+6,213,oPanelProtect)
Endif
return lModifica

and then move all bpainted on function BoxUrllnk
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: 7074
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 46 guests