Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
grid-like behaviour for fox 2.x
Message
De
29/06/2000 14:44:31
 
 
À
29/06/2000 14:10:48
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00386446
Message ID:
00386622
Vues:
17
I'm not sure if this is what you're looking for, but I'll give it a try…

This example combines two browse windows within a main window. I haven't included any functionality to add records to the parent and/or child, but this is also possible. If you don't like the borders of the browse windows, it is possible to hide these by putting these within yet another window, but this complicates it even more.

According to "Hacker's guide", you should never use BROWSE in an application. Although I understand why the authors say this, I don't fully agree. We have used them in our 2.6 applications a lot and they work fine. They are not all that easy to work with, though. You have to spend a lot of time just to line up the windows within the main window.

Please let me know if you need more information.

Jens Erik

Here's the code, paste it into a program file and run.
**********************************************************************
***: This is a simple example of how to combine browse windows within
***: a regular window in FPW2.6
***:
***: This window will include three windows, two browse windows
***: plus 1 window containing the close button.
***: The bottom browse window shows the child records from the
***: parent window.
***:
***: Jens Erik Pettersen, jep@lexi.no, 2000,06,29
**********************************************************************

#REGION 1

***: Create the cursors for this test

CREATE CURSOR Parent;
 (Par_Id N(6,0), ParName C(60))

INDEX ON par_id			TAG par_id
INDEX ON UPPER(ParName)	TAG ParName
SET ORDER TO TAG ParName

INSERT INTO Parent;
 (Par_Id, ParName) VALUES (1, "Parent 1")
INSERT INTO Parent;
 (Par_Id, ParName) VALUES (2, "Parent 2")

CREATE CURSOR Child;
 (Chi_Id N(6,0), Chi_Par N(6, 0), ChiName C(60))

INDEX ON Chi_id		TAG Chi_id
INDEX ON Chi_par	TAG Chi_par
SET ORDER TO TAG Chi_par

INSERT INTO Child;
 (Chi_Id, Chi_par, ChiName);
 VALUES;
 (1, 1, "Child 1, Parent 1")

INSERT INTO Child;
 (Chi_Id, Chi_par, ChiName);
 VALUES;
 (2, 1, "Child 2, Parent 1")

INSERT INTO Child;
 (Chi_Id, Chi_par, ChiName);
 VALUES;
 (3, 2, "Child 1, Parent 2")

***: Set up relationship

SELECT Parent
GO TOP
SET RELATION TO Parent.Par_id INTO Child


#REGION 0
REGIONAL m.currarea, m.talkstat, m.compstat

IF SET("TALK") = "ON"
	SET TALK OFF
	m.talkstat = "ON"
ELSE
	m.talkstat = "OFF"
ENDIF
m.compstat = SET("COMPATIBLE")
SET COMPATIBLE FOXPLUS

m.rborder = SET("READBORDER")
SET READBORDER ON

*       *********************************************************
*       *                                                         
*       *               Windows Window definitions                
*       *                                                         
*       *********************************************************
*

IF NOT WEXIST("winbrows") ;
	OR UPPER(WTITLE("WINBROWS")) == "WINBROWS.PJX" ;
	OR UPPER(WTITLE("WINBROWS")) == "WINBROWS.SCX" ;
	OR UPPER(WTITLE("WINBROWS")) == "WINBROWS.MNX" ;
	OR UPPER(WTITLE("WINBROWS")) == "WINBROWS.PRG" ;
	OR UPPER(WTITLE("WINBROWS")) == "WINBROWS.FRX" ;
	OR UPPER(WTITLE("WINBROWS")) == "WINBROWS.QPR"
	DEFINE WINDOW winbrows ;
		AT  0.000, 0.000  ;
		SIZE 24.333,126.000 ;
		TITLE "Main" ;
		FONT "Arial", 9 ;
		FLOAT ;
		NOCLOSE ;
		MINIMIZE ;
		SYSTEM ;
		COLOR RGB(,,,192,192,192)
	MOVE WINDOW winbrows CENTER
ENDIF

IF NOT WEXIST("winbottom") ;
	OR UPPER(WTITLE("WINBOTTOM")) == "WINBOTTOM.PJX" ;
	OR UPPER(WTITLE("WINBOTTOM")) == "WINBOTTOM.SCX" ;
	OR UPPER(WTITLE("WINBOTTOM")) == "WINBOTTOM.MNX" ;
	OR UPPER(WTITLE("WINBOTTOM")) == "WINBOTTOM.PRG" ;
	OR UPPER(WTITLE("WINBOTTOM")) == "WINBOTTOM.FRX" ;
	OR UPPER(WTITLE("WINBOTTOM")) == "WINBOTTOM.QPR"
	DEFINE WINDOW winbottom ;
		AT 21.000, 0.000 ;
		SIZE 4.533,119.000 ;
		FONT "Arial", 9 ;
		NOFLOAT ;
		NOCLOSE ;
		NOMINIMIZE ;
		NONE ;
		COLOR RGB(,,,192,192,192) ;
		IN WINDOW WINBROWS
ENDIF


*       *********************************************************
*       *                                                         
*       *           TEST/Windows Setup Code - SECTION 2           
*       *                                                         
*       *********************************************************
*

#REGION 1

wby1 =   0.00
wby2 =   8.00
wbx1 =   0.00
wbx2 = 122.00

DEFINE WINDOW winParent;
 FROM wby1,wbx1 TO wby2,wbx2;
 TITLE "Parent";
 FONT "ARIAL",9;
 NOFLOAT;
 NOCLOSE;
 NOGROW;
 NOZOOM;
 DOUBLE;
 IN WINDOW winBrows

wby1 =  10.00
wby2 =  18.00
wbx1 =   0.00
wbx2 = 122.00

DEFINE WINDOW winChild;
 FROM wby1,wbx1 TO wby2,wbx2;
 FONT "ARIAL",9;
 TITLE "Child";
 NOFLOAT;
 NOCLOSE;
 NOGROW;
 NOZOOM;
 DOUBLE;
 IN WINDOW winBrows

SELECT Parent

BROWSE FIELDS;
 ParName :H="Parent name";
 WINDOW winParent;
 IN WINDOW winBrows;
 LOCK 0;
 NODELETE;
 NOCLEAR;
 NOMENU;
 NOWAIT;
 SAVE

SELECT Child

BROWSE FIELDS;
 ChiName :H="Child name";
 WINDOW winChild;
 IN WINDOW winBrows;
 LOCK 0;
 NODELETE;
 NOCLEAR;
 NOMENU;
 NOWAIT;
 SAVE

SELECT PARENT


*       *********************************************************
*       *                                                         
*       *         TESTBOT/Windows Setup Code - SECTION 2          
*       *                                                         
*       *********************************************************
*

#REGION 2


*       *********************************************************
*       *                                                         
*       *               TEST/Windows Screen Layout                
*       *                                                         
*       *********************************************************
*

#REGION 1
IF WVISIBLE("winbrows")
	ACTIVATE WINDOW winbrows SAME
ELSE
	ACTIVATE WINDOW winbrows NOSHOW
ENDIF




*       *********************************************************
*       *                                                         
*       *              TESTBOT/Windows Screen Layout              
*       *                                                         
*       *********************************************************
*

#REGION 2
IF WVISIBLE("winbottom")
	ACTIVATE WINDOW winbottom SAME
ELSE
	ACTIVATE WINDOW winbottom NOSHOW
ENDIF
@ 0.400,55.800 GET m.close ;
	PICTURE "@*HT Close" ;
	SIZE 1.533,12.800,0.800 ;
	DEFAULT 1 ;
	FONT "Arial", 9

IF NOT WVISIBLE("winbottom")
	ACTIVATE WINDOW winbottom
ENDIF
IF NOT WVISIBLE("winbrows")
	ACTIVATE WINDOW winbrows
ENDIF


READ CYCLE MODAL ;
	DEACTIVATE _051181cr9() ;
	WITH parent,child,main,winbrows

RELEASE WINDOW winbottom
RELEASE WINDOW winbrows

#REGION 0

SET READBORDER &rborder

IF m.talkstat = "ON"
	SET TALK ON
ENDIF
IF m.compstat = "ON"
	SET COMPATIBLE ON
ENDIF


*       *********************************************************
*       *                                                         
*       * _051181CR9           Read Level Deactivate              
*       *                                                         
*       * Function Origin:                                        
*       *                                                         
*       *                                                         
*       * From Platform:       Windows                            
*       * From Screen:         Multiple Screens                   
*       * Called By:           READ Statement                     
*       * Snippet Number:      1                                  
*       *                                                         
*       *********************************************************
*
FUNCTION _051181cr9     && Read Level Deactivate
*
* Deactivate Code from screen: TEST
*
#REGION 1
RETURN NOT WREAD()
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform