initially the dialog inserts only one item, but if the user press the 2 or 3 button he can insert 2 or 3 items
the test I made add the items
the second oitem is too big from first why ?
the oitem right must be opanel:nright-50
why is more big ?
the test
- Code: Select all Expand view RUN
#include"fivewin.ch"
Function Test()
local oDlg
local nRow
local aBtnCalc:=array(9)
local oInvoice
local aItems := {}
local nItems:= 1
local nRowItems:= 10
oFont := TFont():New( "Tahoma", 0, 14,, )
oBold := TFont():New( "Tahoma", 0, 14,,.t. )
DEFINE DIALOG oDlg SIZE 878, 680 PIXEL;
FONT oFont Title "test" ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME )
nRow:=30
@ nRow,2 BUTTON aBtnCalc[1] PROMPT "2" SIZE 20,30 PIXEL of oDlg ;
ACTION AddItems(oInvoice,@aItems,2,@nRowItems)
nRow+=32
@ nRow,2 BUTTON aBtnCalc[2] PROMPT "3" SIZE 20,30 PIXEL of oDlg ;
ACTION AddItems(oInvoice,@aItems,3,@nRowItems)
oDlg:bResized := <||
oRect := oDlg:GetCliRect()
>
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oInvoice := CreatePanel( 060,330,180,550,oDlg),;
AddItems(oInvoice,@aItems,nItems,@nRowItems),;
oInvoice:CheckResize(),;
oDlg:resize() )
Return nil
//------------------------------------------------------------------------------------------------//
Function CreatePanel(ntop,nLeft,nRight,nBottom,oDlg)
local oPanel
oPanel := TScrollPanel():New( ntop,nLeft,nRight,nBottom,oDlg, .t. )
oPanel:nRightMargin := 10
oPanel:nBottomMargin := 80
oPanel:WinStyle(WS_BORDER, .t.)
Return oPanel
//------------------------------------------------------------------------------------------------//
Function AddItems(oPanel,aItems,nItems,nRowItems)
local nCol:= 10
local nHeight:= 130
local aGrad:= { CLR_GREEN,CLR_GREEN}
local n
local oItem
local nWidth:= oPanel:nRight-50
DEFINE BRUSH oBrush GRADIENT aGrad
For n= 1 to nItems
oItem:=Tpanel():New( nRowItems, nCol, nHeight+nRowItems,nWidth , oPanel, , , .t. )
oItem:SetBrush( oBrush )
aadd( aItems, {oItem,nRowItems,oItem:cVarname,nWidth} )
nRowItems+=nHeight+2
next
xbrowser aItems
oPanel:setRange()
Return oPanel
I check with xbrowser
the width of first is 500, why from second is 820 ?