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
when I widen the dialog
when I use the dialog without the AS_MDICHILD option
the dialog run ok
the test.prg
- Code: Select all Expand view RUN
#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)