How to Create a Scrolling Field in a BROWSE Window

Last reviewed: April 30, 1996
Article ID: Q130146
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

In FoxPro for Windows versions 2.x, you can't scroll a field in a Browse window when a field is wider than the column width. However, In Visual FoxPro version 3.0, you can make the field in a Browse window an edit box with a scroll bar. This articles shows by example how to do it.

MORE INFORMATION

Code Sample

#DEFINE FIELDLENGTH 100

cText = "This is how it works in 2.x. You can't see the entire field. The ; new way - pay attention to the 'BROWSE NAME' clause. You can now use the ; BROWSE as a Visual FoxPro 3.0 object and introduce a control into a long ; field so that the data is easier to view."

CREATE CURSOR issues (topic C(20), long_desc C(254)) INSERT INTO issues VALUES ('Horizontal Scrolling', cText)

BROWSE TITLE "Close this Window to see what you can do with Visual FoxPro!"

BROWSE NAME oIssues NOWAIT TITLE 'Issues'

LOCAL nColumn, oRef FOR nColumn = 1 TO FCOUNT()

   IF FSIZE(FIELD(m.nColumn)) >= FIELDLENGTH
      oRef = EVAL('oIssues.Column'+LTRIM(STR(nColumn)))
      oRef.AddObject('edit1','editbox')  && Add edit box.
      oRef.edit1.Visible = .t.
      oRef.Sparse = .f.
      oRef.CurrentControl = 'edit1'
      oRef.Width = 150
      oRef.edit1.ScrollBars = 2
   ENDIF
ENDFOR

oIssues.RowHeight = 60     && Change the row height for the browse object.

Instructions

Run the program. In the first browse window, you cannot see the entire long description field (it's an old version 2.x browse window). Press the ESC key to quit the first browse window. Then bring up the second Browse window, which is the new version 3.0 browse window. Now, the entire long description appears in an edit box, so the data can be more easily viewed.

NOTE: You can use BROWSE NAME to create an object reference for the Browse window. This allows you to manipulate the Browse window with object-oriented properties available for the Grid control.


Additional reference words: 3.00 VFoxWin
KBCategory: kbprg kbcode
KBSubcategory: FxprgBrowse


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.