How I must set the scroll to have the same height of the xbrowse ?
I made
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 := oRect:nBottom-45
oBar:refresh()
for n=1 to Len(oPanel:aControls)
oPanel:aControls[n]:refresh()
next
RETURN NIL
>
all the test sources
- 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 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 := oRect:nBottom-60
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