problem with AS MDICHILD

problem with AS MDICHILD

Postby Silvio.Falconi » Mon Nov 21, 2022 4:15 pm

I have a simply dialog with a buttonbar ( 3btn) a Xbrowse and some checkboxes

I need to insert the dialog in an MDI context

when I use AS MDICHILD on a Mdi Window I have this error at init


Image


when I widen the dialog


Image






when I use the dialog without the AS_MDICHILD option

the dialog run ok


the test.prg
Code: Select all  Expand view

#include "FiveWin.ch"
#include "constant.ch"

#define AS_MDICHILD  1
#define AS_DIALOG    2


function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "Test" MDI ;
      MENU BuildMenu()
   SET MESSAGE OF oWnd TO "test" CENTER NOINSET  2015
   ACTIVATE WINDOW oWnd

return nil
//--------------------------------------------------------------//
function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "Test"
      MENU
         MENUITEM "test" ACTION Previsioni()
      ENDMENU
      oMenu:AddMdi()
   ENDMENU

return oMenu

//--------------------------------------------------------------//
Function Previsioni()
   local oDlg,oBar,oFont,oBrw
   local nBottom   := 44
   local nRight    := 110
   local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   local nHeight := nBottom * DLG_CHARPIX_H
   local nClrText := CLR_BLACK
   
   local aGet:=array(10)
   local oGrp:=array(2)
   local cTitle:="Previsioni"
   local oProgress
   local oPrevisione
   local dprimadata,ntotali_records, primo
   local oItem1, oItem2
   local aData:={}
   Local aRuote  := {"Bari","Cagliari","Firenze","Genova",;
                   "Milano","Napoli","Palermo","Roma","Torino",;
                   "Venezia","Nazionale","Tutte"}

   Local lba:=.f.,lca:=.f.,lfi:=.f.,lge:=.f.,lmi:=.f.
   local lna:=.f.,lpa:=.f.,lrm:=.f.,lto:=.f.,lve:=.f.,lnz:=.f.
   local lTutte:=.f.
   local aChk:=array(12)
   local nRow:=30
   local nCol:= 5
   local nSize1:= 50
   local nSize2:= 10



DEFINE FONT oFont NAME "Tahoma"  SIZE 0, -11
   DEFINE DIALOG oDlg        ;
   TITLE "test"   ;
   SIZE nWidth, nHeight   PIXEL ;
   COLOR CLR_BLACK,CLR_WHITE  RESIZABLE

 

    DEFINE BUTTONBAR oBar OF oDlg SIZE 60,30  TOP   2015  NOBORDER
      DEFINE BUTTON OF oBar FILENAME "bitmaps\elabora.bmp"  ;
      Prompt " Elabora " LEFT;
      ACTION  Elabora()  GROUP
      DEFINE BUTTON OF oBar FILENAME "bitmaps\salva.bmp"  ;
      Prompt " Salva " LEFT;
      ACTION  Salva()  GROUP
      DEFINE BUTTON OF oBar FILENAME "bitmaps\stampa.bmp"  ;
      Prompt " Stampa " LEFT;
      ACTION  Stampa()  GROUP

     /*  oBar:bClrGrad = { | lInvert | If( ! lInvert,;
                    { { 1, RGB( 244, 244, 245 ), RGB( 145, 201, 247 ) } },;
                    { { 1, RGB( 244, 244, 245 ), RGB( 145, 201, 247 ) } } ) }
        oDlg:oBar:=oBar*/




//checkboxes
    @ nRow,nCol CHECKBOX aChk[1] VAR lBa  Prompt aRuote[1] SIZE  nSize1,nSize2  PIXEL of oDlg
   nRow+=12
    @ nRow,nCol CHECKBOX aChk[2] VAR lCa  Prompt aRuote[2] SIZE  nSize1,nSize2 PIXEL of oDlg
   nRow+=12
    @ nRow,nCol CHECKBOX aChk[3] VAR lFi  Prompt aRuote[3] SIZE  nSize1,nSize2 PIXEL of oDlg
     nRow+=12
    @ nRow,nCol CHECKBOX aChk[4] VAR lGe  Prompt aRuote[4] SIZE  nSize1,nSize2 PIXEL of oDlg
     nRow+=12
    @ nRow,nCol CHECKBOX aChk[5] VAR lMi  Prompt aRuote[5] SIZE  nSize1,nSize2 PIXEL of oDlg
      nRow+=12
    @ nRow,nCol CHECKBOX aChk[6] VAR lNa  Prompt aRuote[6] SIZE  nSize1,nSize2 PIXEL of oDlg
    nRow:=30
    nCol:=60
     @ nRow,nCol CHECKBOX aChk[7] VAR lPa  Prompt aRuote[7] SIZE  nSize1,nSize2  PIXEL of oDlg
   nRow+=12
    @ nRow,nCol CHECKBOX aChk[8] VAR lRm  Prompt aRuote[8] SIZE  nSize1,nSize2 PIXEL of oDlg
      nRow+=12
    @ nRow,nCol CHECKBOX aChk[9] VAR lTo  Prompt aRuote[9] SIZE  nSize1,nSize2 PIXEL of oDlg
      nRow+=12
    @ nRow,nCol CHECKBOX aChk[10] VAR lVe  Prompt aRuote[10] SIZE  nSize1,nSize2 PIXEL of oDlg
      nRow+=12
    @ nRow,nCol CHECKBOX aChk[11] VAR lNz  Prompt aRuote[11] SIZE  nSize1,nSize2 PIXEL of oDlg
     nRow+=12
    @ nRow,nCol CHECKBOX aChk[12] VAR lTutte  Prompt aRuote[12] SIZE  nSize1,nSize2 PIXEL of oDlg ;
               ON CHANGE (Seleziona_Tutti(aChk,lTutte))
    @ 18,2 GROUP oGrp[1] To nRow+12,130 Label "Ruote attive" TRANSPARENT PIXEL  OF oDlg
     oGrp[1]:nClrText := 0xC38B2B







        @ 20, 140 XBROWSE oBrw  PIXEL OF oDlg ;
                      DATASOURCE aData AUTOCOLS CELL LINES NOBORDER FASTEDIT
                      SetupBrowsePrevisioni(oBrw)
                        oBrw:CreateFromCode()


               oDlg:bResized := <||
                        local oRect := oDlg:GetCliRect()
                           oBar:nWidth:= oRect:nRight
                           oBrw:nWidth:= oRect:nRight-290
                           oBrw:nHeight:= oRect:nBottom-45
               
                           oBar:refresh()
                 RETURN NIL
                       >



ACTIVATE DIALOG oDlg    ;  //AS MDICHILD
                ON INIT (       Eval(oDlg:bResized)   )
RETURN  NIL
//---------------------------------------------------------------//
Function Elabora()
   MsgInfo("elabora")
return nil
Function Salva()
   MsgInfo("salva")
return nil
Function stampa()
   MsgInfo("stampa")
return nil
//---------------------------------------------------------------//

 static function SetupBrowsePrevisioni( oBrw )

 WITH OBJECT oBrw
//      :RecSelShowKeyNo()

      AEval( :aCols, { |o,i| o:cHeader := LTrim( Str( i, 2 ) ) } )

         :nEditTypes    := EDIT_GET
         :nWidths       := 24
         :lDrawBorder := .t.
         :lHscroll            := .t.
         :lVscroll            := .t.
         :l2007               := .f.
         :l2015               := .f.

         :lAllowRowSizing     := .f.
         :lAllowColSwapping   := .f.
         :lAllowColHiding     := .f.
         // NEW
         :lAllowSizings       := .f.
         :lAutoSaves          := .t.

         :lColDividerComplete :=.f.

         :nClrBorder := CLR_GRAY

         :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
         :nColDividerStyle    := LINESTYLE_LIGHTGRAY
         :bRecSelHeader    := { || " " }
         :SetStyle( 2018 )

//         :CreateFromCode()
   END
   return nil
//-------------------------------------------------------------------//

 Static Function Seleziona_Tutti(aChk,lValue)
    For n= 1 to len(aChk)
       aChk[n]:SetCheck(lValue)
   next
   return nil
//-------------------------------------------------------------------//
 


How I can resolve it ?
I tried it on a Lenovo with win 10 pro and a Aus ros with win seven I have the same problem ( the first with 4GB, the second with 8 GB)
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: problem with AS MDICHILD

Postby karinha » Mon Nov 21, 2022 6:37 pm

My opinion, but I'm not sure, since I don't use CODE but RESOURCE WORKSHOP.exe (this doesn't happen) when I use the GROUP command. Maybe changing the class: GROUP.PRG

Mi opinión, pero no estoy seguro, ya que no uso CODE sino RESOURCE WORKSHOP.exe (esto no sucede) cuando uso el comando GROUP. Tal vez cambiando la clase: GROUP.PRG

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

Re: problem with AS MDICHILD

Postby karinha » Mon Nov 21, 2022 7:29 pm

Silvio, intenta asi:

Code: Select all  Expand view

//  @ 18, 2 GROUP oGrp[ 1 ] TO nRow + 12, 130 LABEL "Ruote attive" TRANSPARENT PIXEL  OF oDlg
//  oGrp[ 1 ]:nClrText := 0xC38B2B

    oDlg:bPainted := < |hDC|
       RoundBox( hDC, 02,40,270,230,10,10,CLR_CYAN, 1 )
       oDlg:SayText( "Ruote attive", { 30,30,50,150 }, nil, oFont, { CLR_GREEN, oDlg:nClrPane } )
       return nil
    >
 


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

Re: problem with AS MDICHILD

Postby Silvio.Falconi » Mon Nov 21, 2022 8:04 pm

karinha wrote:Silvio, intenta asi:

Code: Select all  Expand view

//  @ 18, 2 GROUP oGrp[ 1 ] TO nRow + 12, 130 LABEL "Ruote attive" TRANSPARENT PIXEL  OF oDlg
//  oGrp[ 1 ]:nClrText := 0xC38B2B

    oDlg:bPainted := < |hDC|
       RoundBox( hDC, 02,40,270,230,10,10,CLR_CYAN, 1 )
       oDlg:SayText( "Ruote attive", { 30,30,50,150 }, nil, oFont, { CLR_GREEN, oDlg:nClrPane } )
       return nil
    >
 


Regards, saludos.


Run ok but the text "Ruote attive" must be as tgroup text how I resolve ?
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: problem with AS MDICHILD

Postby Silvio.Falconi » Tue Nov 22, 2022 9:48 am

I have another dialog with many tgroup , how I can resolve ?

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

Re: problem with AS MDICHILD

Postby karinha » Tue Nov 22, 2022 12:38 pm

Look at the METHOD PAINT() of the class. There's something wrong with him. See if it finds out.

Mire el METHOD PAINT() de la clase. Hay algo mal con él. A ver si se entera.

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

Re: problem with AS MDICHILD

Postby Silvio.Falconi » Tue Nov 22, 2022 1:04 pm

karinha wrote:Look at the METHOD PAINT() of the class. There's something wrong with him. See if it finds out.

Mire el METHOD PAINT() de la clase. Hay algo mal con él. A ver si se entera.

Regards, saludos.



of tdialog ????
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: problem with AS MDICHILD

Postby karinha » Tue Nov 22, 2022 1:09 pm

Silvio.Falconi wrote:
karinha wrote:Look at the METHOD PAINT() of the class. There's something wrong with him. See if it finds out.

Mire el METHOD PAINT() de la clase. Hay algo mal con él. A ver si se entera.

Regards, saludos.



of tdialog ????



copy from c:\fwh\source\classes\GROUP.PRG and see the METHOD PAINT(). Go stopping the class to see where it enters and causes the error. I think... I'm not sure.

copie desde c:\fwh\source\classes\GROUP.PRG y vea METHOD PAINT(). Y detener la clase para ver dónde entra provoca el error. Creo... No estoy seguro.

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

Re: problem with AS MDICHILD

Postby Silvio.Falconi » Wed Nov 23, 2022 9:42 am

Perhaps Now I resolve with this :

Code: Select all  Expand view

#include "FiveWin.ch"
#include "constant.ch"

#define AS_MDICHILD  1
#define AS_DIALOG    2


function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "Test" MDI ;
      MENU BuildMenu()
   SET MESSAGE OF oWnd TO "test" CENTER NOINSET  2015
   ACTIVATE WINDOW oWnd

return nil
//--------------------------------------------------------------//
function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "Test"
      MENU
         MENUITEM "test" ACTION Previsioni()
      ENDMENU
      oMenu:AddMdi()
   ENDMENU

return oMenu

//--------------------------------------------------------------//
Function Previsioni()
   local oDlg,oBar,oFont,oBrw
   local nBottom   := 44
   local nRight    := 110
   local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   local nHeight := nBottom * DLG_CHARPIX_H
   local nClrText := CLR_BLACK


   local oGrp:=array(2)
   local cTitle:="Previsioni"
   local oProgress
   local oPrevisione
   local dprimadata,ntotali_records, primo
   local oItem1, oItem2
   local aData:={}




   local oPanel
   local aValues  := Array( 12 )
   local aGetChk  := Array( 12 )
   local aGet     := Array( 20 )
   local aRuote   := {"Bari","Cagliari","Firenze","Genova",;
                      "Milano","Napoli","Palermo","Roma","Torino",;
                      "Venezia","Nazionale","Tutte"}





DEFINE FONT oFont NAME "Tahoma"  SIZE 0, -11
   DEFINE DIALOG oDlg        ;
   TITLE "test"   ;
   SIZE nWidth, nHeight   PIXEL ;
   COLOR CLR_BLACK,CLR_WHITE  RESIZABLE



    DEFINE BUTTONBAR oBar OF oDlg SIZE 60,30  TOP   2015  NOBORDER
      DEFINE BUTTON OF oBar FILENAME "bitmaps\elabora.bmp"  ;
      Prompt " Elabora " LEFT;
      ACTION  Elabora()  GROUP
      DEFINE BUTTON OF oBar FILENAME "bitmaps\salva.bmp"  ;
      Prompt " Salva " LEFT;
      ACTION  Salva()  GROUP
      DEFINE BUTTON OF oBar FILENAME "bitmaps\stampa.bmp"  ;
      Prompt " Stampa " LEFT;
      ACTION  Stampa()  GROUP

     /*  oBar:bClrGrad = { | lInvert | If( ! lInvert,;
                    { { 1, RGB( 244, 244, 245 ), RGB( 145, 201, 247 ) } },;
                    { { 1, RGB( 244, 244, 245 ), RGB( 145, 201, 247 ) } } ) }
        oDlg:oBar:=oBar*/




 *   @ 18,2 GROUP oGrp[1] To nRow+12,130 Label "Ruote attive" TRANSPARENT PIXEL  OF oDlg
 *    oGrp[1]:nClrText := 0xC38B2B
    */



        @ 20, 140 XBROWSE oBrw  PIXEL OF oDlg ;
                      DATASOURCE aData AUTOCOLS CELL LINES NOBORDER FASTEDIT
                      SetupBrowsePrevisioni(oBrw)
                        oBrw:CreateFromCode()




  oPanel = TScrollPanel():New( 40, 5, oBrw:nHeight-200, oBrw:nLeft-5, oDlg )
  oPanel:WinStyle( WS_BORDER, .F. )


               oDlg:bResized := <||
                        local oRect := oDlg:GetCliRect()
                           oBar:nWidth:= oRect:nRight
                           oBrw:nWidth:= oRect:nRight-290
                           oBrw:nHeight:= oRect:nBottom-45
                            oPanel:nTop      := oRect:ntop +40
                            oPanel:nLeft     := oRect:nleft+5
                            oPanel:nBottom   := oBrw:nHeight-200
                            oBar:refresh()
                            for n=1 to Len(oPanel:aControls)
                               oPanel:aControls[n]:refresh()
                            next
                 RETURN NIL
                       >



ACTIVATE DIALOG oDlg   AS MDICHILD ;  //AS MDICHILD oPanel:=CreatePanel(oDlg,oBrw,oPanel),;
ON INIT ( CreateOption(oPanel,@aGet,@aValues,aRuote,@aGetChk),;
         oPanel:SetRange(),;
              Eval(oDlg:bResized)   )
RETURN  NIL
//---------------------------------------------------------------//
function CreatePanel(oDlg,oBrw,oPanel)

  oPanel = TScrollPanel():New( 40, 5, oDlg:nBottom - 60, oBrw:nLeft-5, oDlg )
  oPanel:WinStyle( WS_BORDER, .F. )

return oPanel
//---------------------------------------------------------------//
function CreateOption(oPanel,aGet,aValues,aRuote,aGetChk)


   local nTop:= 2
   local nCol:= 5
   local nCol2:= 20
   local nSizew:=100
   local nSizeh:=18
   local oGrp

   AFill( aValues, .F. )


  oPanel:AddText( 5, nCol, 100, 18, "Ruote attive", ,, .t., 0xC38B2B, , 1 )

  @ nTop,        ncol CHECKBOX aGetChk[1]  VAR aValues[ 1 ]   PROMPT aRuote[1] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol CHECKBOX aGetChk[2]  VAR aValues[ 2 ]   PROMPT aRuote[2] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol CHECKBOX aGetChk[3]  VAR aValues[ 3 ]   PROMPT aRuote[3] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol CHECKBOX aGetChk[4]  VAR aValues[ 4 ]   PROMPT aRuote[4] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol CHECKBOX aGetChk[5]  VAR aValues[ 5 ]   PROMPT aRuote[5] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol CHECKBOX aGetChk[6]  VAR aValues[ 6 ]   PROMPT aRuote[6] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  nTop:= 2
  @ nTop ,       ncol2       CHECKBOX aGetChk[7]  VAR aValues[ 7 ]   PROMPT aRuote[7]   SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol2 CHECKBOX aGetChk[8]  VAR aValues[ 8 ]   PROMPT aRuote[8]  SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol2 CHECKBOX aGetChk[9]  VAR aValues[ 9 ]   PROMPT aRuote[9]  SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol2 CHECKBOX aGetChk[10] VAR aValues[ 10 ]  PROMPT aRuote[10] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol2 CHECKBOX aGetChk[11] VAR aValues[ 11 ]  PROMPT aRuote[11] SIZE nSizew,nSizeh OF oPanel  // SCROLL ADJUST
  @ nTop += 1.7, ncol2 CHECKBOX aGetChk[12] VAR aValues[ 12 ]  PROMPT aRuote[12] SIZE nSizew,nSizeh OF oPanel ; // SCROLL ADJUST
                              ON CHANGE (Select_All(aGetChk,aValues[12]))


   RETURN NIL

//---------------------------------------------------------------//
Function Elabora()
   MsgInfo("elabora")
return nil
Function Salva()
   MsgInfo("salva")
return nil
Function stampa()
   MsgInfo("stampa")
return nil
//---------------------------------------------------------------//


//-------------------------------------------------------------------//
 Static Function Select_All(aGet,lValue)
     local n
    For n= 1 to len(aGet)
       aGet[n]:SetCheck(lValue)
    next

   return nil
//-------------------------------------------------------------------//
    static function SetupBrowsePrevisioni( oBrw )

 WITH OBJECT oBrw
//      :RecSelShowKeyNo()

      AEval( :aCols, { |o,i| o:cHeader := LTrim( Str( i, 2 ) ) } )

         :nEditTypes    := EDIT_GET
         :nWidths       := 24
         :lDrawBorder := .t.
         :lHscroll            := .t.
         :lVscroll            := .t.
         :l2007               := .f.
         :l2015               := .f.

         :lAllowRowSizing     := .f.
         :lAllowColSwapping   := .f.
         :lAllowColHiding     := .f.
         // NEW
         :lAllowSizings       := .f.
         :lAutoSaves          := .t.

         :lColDividerComplete :=.f.

         :nClrBorder := CLR_GRAY

         :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
         :nColDividerStyle    := LINESTYLE_LIGHTGRAY
         :bRecSelHeader    := { || " " }
         :SetStyle( 2018 )

//         :CreateFromCode()
   END
   return nil
 


the only thing I didn't understand why the scroll panel doesn't resize, i.e. it should be as tall as the xbrowse
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: problem with AS MDICHILD

Postby karinha » Wed Nov 23, 2022 2:01 pm

En mi humilde opinión, es perfecto. Excelente trabajo.

In my humble opinion, it's perfect. Excellent job.

Code: Select all  Expand view

// C:\FWH\SAMPLES\SILVPREV.PRG

#include "FiveWin.ch"
#include "constant.ch"

#define AS_MDICHILD  1
#define AS_DIALOG    2

STATIC oWnd

FUNCTION Main()

   DEFINE WINDOW oWnd TITLE "Test" MDI MENU BuildMenu()

   SET MESSAGE OF oWnd TO "test" CENTER NOINSET  2015

   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu 2015

      MENUITEM "Test"

      MENU
         MENUITEM "test" ACTION Previsioni()
      ENDMENU

      oMenu:AddMdi()

   ENDMENU

RETURN( oMenu )

FUNCTION Previsioni()

   LOCAL oDlg, oBar, oFont, oBrw, N
   LOCAL nBottom   := 44
   LOCAL nRight    := 110
   LOCAL nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   LOCAL nHeight := nBottom * DLG_CHARPIX_H
   LOCAL nClrText := CLR_BLACK
   LOCAL oGrp := Array( 2 )
   LOCAL cTitle := "Previsioni"
   LOCAL oProgress
   LOCAL oPrevisione
   LOCAL dprimadata, ntotali_records, primo
   LOCAL oItem1, oItem2
   LOCAL aData := {}
   LOCAL oPanel
   LOCAL aValues  := Array( 12 )
   LOCAL aGetChk  := Array( 12 )
   LOCAL aGet     := Array( 20 )
   LOCAL aRuote   := { "Bari", "Cagliari", "Firenze", "Genova", ;
                       "Milano", "Napoli", "Palermo", "Roma", "Torino", ;
                       "Venezia", "Nazionale", "Tutte" }

   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg TITLE "test" SIZE nWidth, nHeight  PIXEL ;
      COLOR CLR_BLACK, CLR_WHITE  RESIZABLE FONT oFont TRANSPARENT

   oDlg:lHelpIcon := .F.

   DEFINE BUTTONBAR oBar BUTTONSIZE 60, 30 _3DLOOK TOP OF oDlg 2015 NOBORDER

   oBar:SetFont( oFont )
   oBar:nClrText := CLR_HBLUE
   oBar:Adjust()

   DEFINE BUTTON OF oBar FILENAME "bitmaps\elabora.bmp" ;
      PROMPT " Elabora " LEFT ACTION  Elabora() GROUP

   DEFINE BUTTON OF oBar FILENAME "bitmaps\salva.bmp"   ;
      PROMPT " Salva " LEFT ACTION  Salva() GROUP

   DEFINE BUTTON OF oBar FILENAME "bitmaps\stampa.bmp"  ;
      PROMPT " Stampa " LEFT ACTION  Stampa() GROUP

   @ 20, 140 XBROWSE oBrw  PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS CELL LINES NOBORDER FASTEDIT

   SetupBrowsePrevisioni( oBrw )
   oBrw:CreateFromCode()

   oPanel = TScrollPanel():New( 40, 5, oBrw:nHeight - 200, oBrw:nLeft - 5, oDlg )
   oPanel:WinStyle( WS_BORDER, .F. )

   oDlg:bResized := < ||
   LOCAL oRect    := oDlg:GetCliRect()
   oBar:nWidth    := oRect:nRight
   oBrw:nWidth    := oRect:nRight - 290
   oBrw:nHeight   := oRect:nBottom - 45
   oPanel:nTop    := oRect:ntop + 40
   oPanel:nLeft   := oRect:nleft + 5
   oPanel:nBottom := oBrw:nHeight - 200
   oBar:refresh()

   FOR n = 1 TO Len( oPanel:aControls )
      oPanel:aControls[ n ]:Refresh()
   NEXT

   RETURN NIL
   >

   ACTIVATE DIALOG oDlg AS MDICHILD ;
      ON INIT ( CreateOption( oPanel, @aGet, @aValues, aRuote, @aGetChk ), ;
      oPanel:SetRange(), Eval( oDlg:bResized )   )

   oFont:End()

RETURN  NIL

FUNCTION CreatePanel( oDlg, oBrw, oPanel )

   oPanel = TScrollPanel():New( 40, 5, oDlg:nBottom - 60, oBrw:nLeft - 5, oDlg )
   oPanel:WinStyle( WS_BORDER, .F. )

RETURN oPanel

FUNCTION CreateOption( oPanel, aGet, aValues, aRuote, aGetChk )

   LOCAL nTop := 2
   LOCAL nCol := 5
   LOCAL nCol2 := 20
   LOCAL nSizew := 100
   LOCAL nSizeh := 18
   LOCAL oGrp, nChk := 0

   AFill( aValues, .F. )

   oPanel:AddText( 5, nCol, 100, 18, "Ruote attive", ,, .T., 0xC38B2B, , 1 )

   @ nTop,        ncol CHECKBOX aGetChk[ 1 ]  VAR aValues[ 1 ]   ;
      PROMPT aRuote[ 1 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 2 ]  VAR aValues[ 2 ]   ;
      PROMPT aRuote[ 2 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 3 ]  VAR aValues[ 3 ]   ;
      PROMPT aRuote[ 3 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 4 ]  VAR aValues[ 4 ]   ;
      PROMPT aRuote[ 4 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 5 ]  VAR aValues[ 5 ]   ;
      PROMPT aRuote[ 5 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 6 ]  VAR aValues[ 6 ]   ;
      PROMPT aRuote[ 6 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   nTop := 2

   @ nTop,        ncol2 CHECKBOX aGetChk[ 7 ]  VAR aValues[ 7 ]   ;
      PROMPT aRuote[ 7 ]   SIZE nSizew, nSizeh OF oPanel          ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 8 ]  VAR aValues[ 8 ]   ;
       PROMPT aRuote[ 8 ]  SIZE nSizew, nSizeh OF oPanel          ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 9 ]  VAR aValues[ 9 ]   ;
      PROMPT aRuote[ 9 ]  SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 10 ] VAR aValues[ 10 ]  ;
      PROMPT aRuote[ 10 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 11 ] VAR aValues[ 11 ]  ;
      PROMPT aRuote[ 11 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 12 ] VAR aValues[ 12 ]  ;
      PROMPT aRuote[ 12 ] SIZE nSizew, nSizeh OF oPanel           ;
      ON CHANGE ( Select_All( aGetChk, aValues[ 12 ] ) )          ;
      UPDATE COLOR CLR_CYAN, CLR_WHITE

RETURN NIL

FUNCTION Elabora()

   MsgInfo( "elabora" )

RETURN NIL

FUNCTION Salva()

   MsgInfo( "salva" )

RETURN NIL

FUNCTION stampa()

   MsgInfo( "stampa" )

RETURN NIL

STATIC FUNCTION Select_All( aGet, lValue )

   LOCAL n

   FOR n = 1 TO Len( aGet )
      aGet[ n ]:SetCheck( lValue )
   NEXT

RETURN NIL

STATIC FUNCTION SetupBrowsePrevisioni( oBrw )

   WITH OBJECT oBrw

      AEval( :aCols, {| o, i | o:cHeader := LTrim( Str( i, 2 ) ) } )

      :nEditTypes    := EDIT_GET
      :nWidths       := 24
      :lDrawBorder := .T.
      :lHscroll            := .T.
      :lVscroll            := .T.
      :l2007               := .F.
      :l2015               := .F.

      :lAllowRowSizing     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.

      // NEW
      :lAllowSizings       := .F.
      :lAutoSaves          := .T.

      :lColDividerComplete := .F.

      :nClrBorder := CLR_GRAY

      :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :bRecSelHeader    := {|| " " }
      :SetStyle( 2018 )

   END

RETURN NIL

// FIN / END
 


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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests