Problem with New AS MDICHILD

Problem with New AS MDICHILD

Postby Silvio.Falconi » Sat May 07, 2022 11:39 am

Image

I tried to create a dialog with some buttons and an xrowse
The dialog does not enlarge and I have to enlarge it


As you can see in the figure I don't see the header of the dialog


If I use the command oDialogo: Maximize () does not work correctly as you can see below


Image


I create the dialog with :
Code: Select all  Expand view

DEFINE DIALOG oDialogo SIZE nWidth, nHeight;
                     TRANSPARENT PIXEL;
                      TITLE "Analisi Previsione" FONT oFontDlg ;
                      COLOR CLR_BLACK,CLR_WHITE
...
 ACTIVATE DIALOG oDialogo CENTERED AS MDICHILD




but the most extravagant thing is that when I open the dialog the progress control comes alive without me giving it the start




Image


I made the progress control with

Code: Select all  Expand view
@ 1, 1 PROGRESS oProgress POSITION 1 SIZE 100, 12 MARQUEE






How I can resolve all these errors ?
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with New AS MDICHILD

Postby karinha » Tue May 10, 2022 2:13 pm

Good Morning. A complete example in .ZIP or .RAR is always needed for possible tests. Without it, there is no magic to solve.

Buen día. Siempre se necesita un ejemplo completo en .ZIP o .RAR para posibles pruebas. Sin ella, no hay magia que resolver.

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

Re: Problem with New AS MDICHILD

Postby Silvio.Falconi » Tue May 10, 2022 3:39 pm

karinha wrote:Good Morning. A complete example in .ZIP or .RAR is always needed for possible tests. Without it, there is no magic to solve.

Buen día. Siempre se necesita un ejemplo completo en .ZIP o .RAR para posibles pruebas. Sin ella, no hay magia que resolver.

Regards, saludos.


here my test

Code: Select all  Expand view

 #include "fivewin.ch"
  #include "Constant.ch"

 REQUEST DBFCDX

    #define AS_MDICHILD  1
    #define AS_DIALOG    2


    //----------------------------------------------------------------------------//

    function Main()

       local oWnd, oBar, oMenu
       RddSetDefault( "DBFCDX" )

   SetHandleCount( 100 )




   SET DATE FORMAT "dd-mm-yyyy"
   SET DELETED     ON
   SET CENTURY     ON
   SET EPOCH TO    year( date() ) - 20
   SET MULTIPLE    OFF
       SetGetColorFocus()

       DEFINE WINDOW oWnd MDI TITLE "FWH18.08: DIALOG IN MDICHILD WINDOW"
       DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
       DEFINE BUTTON OF oBar PROMPT "MDIDLG-OLD" CENTER ACTION NIL
       DEFINE BUTTON OF oBar PROMPT "MDIDLG-NEW" CENTER ACTION CreateDialog( AS_MDICHILD )
       DEFINE BUTTON OF oBar PROMPT "DIALOG"     CENTER ACTION CreateDialog( AS_DIALOG )
       ACTIVATE WINDOW oWnd

    return nil

//----------------------------------------------------------------------------//
 static function CreateDialog( nAs )

       local oDialogo
       local oBtnElabora,oBtnSave,oBtnPrint,oBtnCopy
       local oBrw
       local aData:={}
       local aRuote:= {"Bari","Cagliari","Firenze","Genova",;
                          "Milano","Napoli","Palermo","Roma","Torino",;
                          "Venezia","Nazionale"}
       local oSay:=array(10)
       local oChk:=array(11)
       local aBtnCalc[4]
       local nBtnSizeW:=30
       local nBtnSizeH:=10
       local nBottom   := 33
       local nRight    := 100
       local nWidth :=  Max( nRight * DLG_CHARPIX_W, 155 )
       local nHeight := nBottom * DLG_CHARPIX_H
       local nRow:=3,nCol:=2
       local oFontDlg := TFont():New( "Segoe UI",  0, ( 14 ), .f., .f. )
       local oGrp:=array(5)

    local  nColorBtnCe     := rgb(250,176,175)
    local  nColorBtnC      := rgb(250,176,175)
    local  nColorBtnAbort  := rgb(211,221,221)
    local  nColorBtnPaste  := rgb(211,221,221)
    local  nColorBtnText   := rgb(101,138,182)
    local  nColorBtns      := rgb(231,236,242)
    local  nColorBtnNum    := rgb( 238,239,240)
    local oCursor :=TCursor():New(,'HAND')
    local cDir := ".\DATA\"
    local oPrevisione
    local dprimadata,ntotali_records, primo
    local aSceltaRuote := {}
    local oProgress
    local nNumeriMax:= 10
    local oExBar

        DEFINE DIALOG oDialogo SIZE nWidth, nHeight;
                     TRANSPARENT PIXEL;
                      TITLE "
Analisi Previsione" FONT oFontDlg ;
                      COLOR CLR_BLACK,CLR_WHITE

     *  oDialogo:nStyle := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX,   0 )

   @ 1, 1 PROGRESS oProgress POSITION 1 SIZE 100, 12 //MARQUEE

   @  nRow,nCol  BUTTONBMP aBtnCalc[1]  PROMPT "
     Elabora" ;
   BITMAP "
.\bitmaps\elabora.png" TEXTRIGHT SIZE nBtnSizeW,nBtnSizeH ;
   OF  oDialogo    PIXEL ;
   ACTION (adata:= Calcolo_Previsione(oProgress,oSay[2]),oBrw:SetArray(aData,,,.F.),oBrw:refresh())
   nCol+=nBtnSizeW+1

       @  nRow,nCol  BUTTONBMP aBtnCalc[2]  PROMPT "
   Salva" ;
       BITMAP "
.\bitmaps\salva.png"  TEXTRIGHT;
       SIZE nBtnSizeW,nBtnSizeH OF  oDialogo   PIXEL ACTION   NIL

   nCol+=nBtnSizeW+1
   @  nRow,nCol  BUTTONBMP aBtnCalc[3]  PROMPT "
     Stampa" ;
   BITMAP "
.\bitmaps\stampa.png" TEXTRIGHT;
   SIZE nBtnSizeW,nBtnSizeH OF  oDialogo   PIXEL ACTION oBrw:report()

   nCol+=nBtnSizeW+1

   @  nRow,nCol  BUTTONBMP aBtnCalc[4]  PROMPT "
   Copia" ;
   BITMAP "
.\bitmaps\copy.png" TEXTRIGHT;
   SIZE nBtnSizeW,nBtnSizeH OF  oDialogo  PIXEL ACTION NIL





   @ 70,10 say oSay[2] Prompt space(200) of oDialogo ;
   SIZE 100,10 PIXEL  TRANSPARENT

   @ 30, 10 XBROWSE  oBrw OF oDialogo SIZE -10,-20 PIXEL NOBORDER
      oBrw:SetArray(aData,,,.F.)
      SetupBrowserPrev(oBrw)










            oDialogo:bResized  := <||
            local oRect          := oDialogo:GetCliRect()
            aBtnCalc[1]:nTop     := oRect:nTop +1
            aBtnCalc[1]:nLeft    := oRect:nleft +2
            aBtnCalc[2]:nTop     := oRect:nTop +1
            aBtnCalc[2]:nLeft    := oRect:nleft +65
            aBtnCalc[3]:nTop     := oRect:nTop +1
            aBtnCalc[3]:nLeft    := oRect:nleft +125
            aBtnCalc[4]:nTop     := oRect:nTop +1
            aBtnCalc[4]:nLeft    := oRect:nleft +180
            oProgress:nTop       := oRect:nTop +1
            oProgress:nleft      := oRect:nleft+250
            oSay[2]:nTop         := oRect:nTop +1
            oSay[2]:nleft         := oRect:nleft+450
            oBrw:nTop            := oRect:nTop+30
            oBrw:nleft           := oRect:nleft+250
            oBrw:nWidth          := oRect:nWidth -255

            oExBar:nBottom := oBrw:nBottom
            oGrp[1]:refresh()
            oGrp[2]:refresh()
             oExBar:refresh()
            oSay[2]:refresh()

        return nil
       >

       if nAs == AS_MDICHILD

          ACTIVATE DIALOG oDialogo CENTERED AS MDICHILD ;
                 ON INIT (oExBar:= CreatePanel(oDialogo,oBrw),;
                          PlaceControls(oExBar,oGrp),;
                           EVAL( oDialogo:bResized) )



       elseif nAs == AS_DIALOG

          ACTIVATE DIALOG oDialogo CENTERED ;
                        ON INIT (oExBar:= CreatePanel(oDialogo,oBrw),;
                          PlaceControls(oExBar,oGrp),;
                           EVAL( oDialogo:bResized) )
       endif

       return oDialogo


function CreatePanel(oDlg,oBrw)
    local oPanel
   oPanel   := TScrollPanel():New( 30,002,oBrw:nBottom,249,oDlg, .t. )
   oPanel:nRightMargin     := 5
  oPanel:nBottomMargin    := 210
   oPanel:WinStyle(WS_BORDER, .t.)
return  oPanel

function PlaceControls(oExBar,oGrp)

   local n,nI
   local aChk:=array(11)
   local nRow:= 100
   local nCol:= 10
   local oSay1,oSay3
   local aSceltaRuote:={.f.,.f.,.f.,.f.,.f.,.f.,.f.,.f.,.f.,.f.,.f.}
   local lFi:=.f.
   local lGe:=.f.

  local aRuote:= {"
Bari","Cagliari","Firenze","Genova",;
                          "
Milano","Napoli","Palermo","Roma","Torino",;
                          "
Venezia","Nazionale"}


  @ 0, 1 GROUP   oGrp[1] TO 40,230  PIXEL  OF oExBar TRANSPARENT

  @ 12 , 5 SAY oSay1 Prompt "
Parametri di ricerca" SIZE 120, 20 PIXEL OF oExBar TRANSPARENT

  @ 40, 1 GROUP oGrp[2] TO 180,230  PIXEL  OF oExBar  TRANSPARENT
 * @ 200, 1 GROUP oGrp[3] TO 600,230  PIXEL  OF oExBar TRANSPARENT


   nRow+=2
  @ nRow , 5 SAY oSay3 Prompt "
Selezione ruote" SIZE 120, 20 PIXEL OF oExBar TRANSPARENT
  nRow+=22
  @ nRow, nCol CHECKBOX aChk[1] VAR aSceltaRuote[1] PROMPT aRuote[1] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
  @ nRow, nCol CHECKBOX aChk[2] VAR aSceltaRuote[2] PROMPT aRuote[2] SIZE 80, 20 PIXEL OF oExBar
   nRow+=22
   @ nRow, nCol CHECKBOX aChk[3] VAR aSceltaRuote[3] PROMPT aRuote[3] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
   @ nRow, nCol CHECKBOX aChk[4] VAR aSceltaRuote[4] PROMPT aRuote[4] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
   @ nRow, nCol CHECKBOX aChk[5] VAR aSceltaRuote[5] PROMPT aRuote[5] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
   @ nRow, nCol CHECKBOX aChk[6] VAR aSceltaRuote[6] PROMPT aRuote[6] SIZE 80, 20 PIXEL OF oExBar


   nRow:= 102
   nRow+=22
   nCol:=110
   @ nRow, nCol CHECKBOX aChk[7] VAR aSceltaRuote[7] PROMPT aRuote[7] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
  @ nRow, nCol CHECKBOX aChk[8] VAR aSceltaRuote[8] PROMPT aRuote[8] SIZE 80, 20  PIXEL OF oExBar
   nRow+=22
   @ nRow, nCol CHECKBOX aChk[9] VAR aSceltaRuote[9] PROMPT aRuote[9] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
   @ nRow, nCol CHECKBOX aChk[10] VAR aSceltaRuote[10] PROMPT aRuote[10] SIZE 80, 20 PIXEL OF oExBar
    nRow+=22
   @ nRow, nCol CHECKBOX aChk[11] VAR aSceltaRuote[11] PROMPT aRuote[11] SIZE 80, 20 PIXEL OF oExBar



       oExBar:SetRange()
return NIL






 //--------------------------------------------------------------------------------//
Function BuildExBar(odialogo,oSay,oExBar)
    local aInfo   := {}
  * local aReturn := {}
  local aSelezione := {}
  local lreturn :=.f.
   Local aRuote  := {"
Bari","Cagliari","Firenze","Genova",;
                   "
Milano","Napoli","Palermo","Roma","Torino",;
                   "
Venezia","Nazionale"}
   Local oLbx,oBtn4,oBtn5,oBtn1,oBtn2
   Local oFont
   local nRow:=70
   local ncol:= 2
   local oChk[11]
   local alvalue[11]

   DEFINE FONT oFont NAME "
tahoma" SIZE 0,-12 BOLD
     @ 70,10 say oSay[1] Prompt "
Ricerca Ruote" of oExBar ;
         SIZE 100,20 PIXEL  TRANSPARENT
         oSay[1]:setcolor(rgb(250,176,175),0)
         oSay[1]:ltransparent:=.t.



   for n := 1 to len( aRuote )
      nRow+=12
     next


   return nil













proc SetupBrowserPrev(oBrw)

   ADD COLUMN TO oBrw HEADER "
Ruota" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,1] } CENTER
   ADD COLUMN TO oBrw HEADER "
1"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2] } CENTER
   ADD COLUMN TO oBrw HEADER "
2"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,3] } CENTER
   ADD COLUMN TO oBrw HEADER "
3"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,4] } CENTER
   ADD COLUMN TO oBrw HEADER "
4"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,5] } CENTER
   ADD COLUMN TO oBrw HEADER "
5"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,6] } CENTER
   ADD COLUMN TO oBrw HEADER "
6"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,7] } CENTER
   ADD COLUMN TO oBrw HEADER "
7"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,8] } CENTER
   ADD COLUMN TO oBrw HEADER "
8"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,9] } CENTER
   ADD COLUMN TO oBrw HEADER "
9"     DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,10] } CENTER
   ADD COLUMN TO oBrw HEADER "
10"    DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,11] } CENTER


    WITH OBJECT oBrw
      :nRowHeight    := 22
      :nClrBorder := CLR_GRAY
      :lDrawBorder := .t.
      :nColorBox := CLR_HRED
      :nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
      :lHscroll            := .f.
      :l2007               := .F.
      :l2015               := .f.
     * :nStretchCol         := STRETCHCOL_WIDEST
      :lAllowRowSizing     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.
      :lRecordSelector     := .F.
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle    := LINESTYLE_NOLINES
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :lDisplayZeros       := .f.

        FOR i := 1 TO LEN(:aCols)
         oCol := :aCols[ i ]
         oCol:nWidth   := 30
         if i >1  .and. hb_bitand(i,1)>0
          *  oCol:bClrStd := {|| { CLR_WHITE, RGB(255,0,0) } }
         *   oCol:bClrSelFocus := {|| { CLR_BLACK, { { 1, RGB( 252, 235, 220  ), RGB( 255, 0,0  ) } }}}
         * :bClrStd := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, RGB(160,225,255), CLR_WHITE ) } }

      endif
      NEXT



      :CreateFromCode()
      :aCols[ 1 ]:nWidth   := 100
      :aCols[ 1 ]:nDataStrAlign   := AL_LEFT
      :SetStyle( 2018 )
   end with
   Return nil

//--------------------------------------------------------------//
   FUNCTION Cf(dTemp)
   LOCAL Meses:="
GenFebMarAprMagGiuLugAgoSetOttNovDic"
   LOCAL f, m, cMes, dFech
   f:=DTOS (dTemp)
   m:=MONTH(dTemp)
   cMes:=IF(m<>0,SubStr(Meses,(m*3)-2,3),"
")
   dFech:=IF(m<>0,SubStr(f,7,2)+'-'+cMes+'-'+SubStr(f,1,4),'')
   RETURN (dFech)
//--------------------------------------------------------------//


 Function Calcolo_Previsione(oProgress,oSay)
    local  aPrevisioni:= {}
    local aRuote:= {"
Bari","Cagliari","Firenze","Genova",;
                          "
Milano","Napoli","Palermo","Roma","Torino",;
                          "
Venezia","Nazionale"}
    local n
    for n= 1 to 11
       AADD( aPrevisioni, {aRuote[n],0,0,0,0,0,0,0,0,0,0})
      next
   return aPrevisioni
//-------------------------------------------------------------------/
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 73 guests