Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programatically move cursor in a BROWSE window
Message
De
05/08/2007 15:30:48
 
 
À
05/08/2007 09:33:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01245985
Message ID:
01246053
Vues:
25
Marcia,

Thanks for the tip. I never new that you could make a BROWSE window into an object. This was the missing piece I was needing.

BTW ... I wanted to do this so that my BROWSE window could emulate the action of an Access window when you press the and keys.

It still turned into quit a chore to get it to work but with your tip I was successful. I discovered that the "ActiveCell" is relative to the visible columns in the BROWSE window so I had to work a figuring out how to activate the last cell/column (i.e. .ColumnCount and/or fcount() alone didn't work). But, when I found the .LeftColumn property, everything fell into place.

The keyboard commands were added to insure that the cell is selected is highlighted. There may be a simpler why to do this but it is now working so I'm happy.

Thanks again for you tip. Also, thanks for all of the great articles and books you have authored over the years!

Robert Wright
PROCEDURE GoFirstField
IF VARTYPE(obrowse) = 'O'
	obrowse.doscroll(6)
	obrowse.ActivateCell(RECNO(),1)
	KEYBOARD '{SHIFT+RIGHTARROW}'
	KEYBOARD '{HOME}'
	KEYBOARD '{SHIFT+END}'
ENDIF
RETURN

PROCEDURE GoLastField
IF VARTYPE(obrowse) = 'O'
	obrowse.doscroll(7)
	obrowse.ActivateCell(RECNO(),obrowse.ColumnCount - obrowse.LeftColumn + 1)
	KEYBOARD '{SHIFT+RIGHTARROW}'
	KEYBOARD '{HOME}'
	KEYBOARD '{SHIFT+END}'
ENDIF 
RETURN
>I can identify the fields that I want to move to with FIELD(1) and FIELD(FCOUNT(SELECT())) but can seem to find a command that moves the cursor to either of these fields.

>I assume that you are using the NAME clause of the browse command ( BROWSE .... NAME oBrowse ) becuase this enables you to manipulate the browse window the same way as you do a grid.

>What you need to do is use the ActivateCell() method of the grid and, if the browse scrolls horizontally, combine this with the grid's DoScroll() method.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform