variable number of folders

variable number of folders

Postby MarcoBoschi » Wed Nov 17, 2010 3:24 pm

Hi,
I have to create a Dialog with a variable number of folder.
From code (not from res with redefine)
Here's my sample code
It works but I have to substitute this line of code...

@ 1 , 1 FOLDER oFld OF oDlg ;
PROMPT "Pag&1" , ;
"Pag&2" , ;
"Pag&3" , ;
"Pag&4" ;
SIZE 400 , 400 PIXEL

with something else that permit to me to manage a variable number of folders
I have tried with
oFld:Additem("1")
oFld:Additem("2")
without success



#include "fivewin.ch"

FUNCTION MAIN

LOCAL oDlg
LOCAL oFld

LOCAL nPag , nRow , nCol
LOCAL nMaxPag := 4

DECLARE aEti[ 4 , 2 , 2 ]
DECLARE oEti[ 4 , 2 , 2 ]

FOR nPag := 1 TO 4
FOR nRow := 1 TO 2
FOR nCol := 1 TO 2

oEti[ nPag , nRow, nCol ] := NIL
aEti[ nPag , nRow, nCol ] := STR( nPag,3 ) + STR( nRow,3 ) + STR( nCol,3 )

NEXT nCol

NEXT nRow

NEXT nPag

DEFINE DIALOG oDlg FROM 0 , 0 TO 600 , 600 PIXEL

@ 1 , 1 FOLDER oFld OF oDlg ;
PROMPT "Pag&1" , ;
"Pag&2" , ;
"Pag&3" , ;
"Pag&4" ;
SIZE 400 , 400 PIXEL

FOR nPag := 1 TO 4
FOR nRow := 1 TO 2
FOR nCol := 1 TO 2

creaget( oFld, nPag , nRow , nCol , oEti, aEti )
NEXT nCol

NEXT nRow

NEXT nPag

ACTIVATE DIALOG oDlg CENTER

RETURN NIL

FUNCTION CREAGET( oFld, nPag, nRow, nCol , oEti, aEti )

@ nRow * 20 , nCol * 100 - 50 GET oEti[ nPag, nRow, nCol ] VAR aEti[ nPag, nRow, nCol ] ;
OF oFld:adialogs[ nPag ] SIZE 60 , 20 PIXEL

RETURN NIL
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: variable number of folders

Postby MarcoBoschi » Wed Nov 17, 2010 3:41 pm

This a partial solution
@ 1 , 1 FOLDER oFld OF oDlg PROMPT "" SIZE 400 , 400 PIXEL
buot this line of command creates a first folder that
is it possible to omit this folder?
Thanks in advance

Marco Boschi


#include "fivewin.ch"

FUNCTION MAIN

LOCAL oDlg
LOCAL oFld

LOCAL nPag , nRow , nCol
LOCAL nMaxPag := 4

DECLARE aEti[ 4 , 2 , 2 ]
DECLARE oEti[ 4 , 2 , 2 ]

FOR nPag := 1 TO 4
FOR nRow := 1 TO 2
FOR nCol := 1 TO 2

oEti[ nPag , nRow, nCol ] := NIL
aEti[ nPag , nRow, nCol ] := STR( nPag,3 ) + STR( nRow,3 ) + STR( nCol,3 )

NEXT nCol

NEXT nRow

NEXT nPag

DEFINE DIALOG oDlg FROM 0 , 0 TO 600 , 600 PIXEL

@ 1 , 1 FOLDER oFld OF oDlg PROMPT "" SIZE 400 , 400 PIXEL

ACTIVATE DIALOG oDlg CENTER ON INIT creafld( oFld, nPAg, nRow, nCol, oEti, aEti )

RETURN NIL

FUNCTION CREAFLD( oFld, nPAg, nRow, nCol, oEti, aEti )
FOR nPag := 1 TO 4
oFld:additem(STR(nPag))
FOR nRow := 1 TO 2
FOR nCol := 1 TO 2


creaget( oFld, nPag , nRow , nCol , oEti, aEti )

NEXT nCol

NEXT nRow

NEXT nPag
RETURN NIL

FUNCTION CREAGET( oFld, nPag, nRow, nCol , oEti, aEti )

@ nRow * 20 , nCol * 100 - 50 GET oEti[ nPag, nRow, nCol ] VAR aEti[ nPag, nRow, nCol ] ;
OF oFld:adialogs[ nPag ] SIZE 60 , 20 PIXEL

RETURN NIL
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: variable number of folders (SOLVED)

Postby MarcoBoschi » Wed Nov 17, 2010 4:57 pm

With this command line

oFld := TFolder():New( 1, 1, { } , , oDlg, 1, , , .T., .F., 400 , 400 )

Thanks
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 87 guests