Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BROWSE window format

Status
Not open for further replies.

OldManOBIE

Programmer
Feb 22, 2011
9
US
In my code I use the following:
---
BROWSE NAME oBrowse NOWAIT
oBrowse.FontName = "Courier New"
oBrowse.FontSize = 10
oBrowse.Autofit()
BROWSE LAST
---
When the user double-clicks the MEMO field, I would like to be able to format the text there.

Any suggestions?
 
My advice is to not use BROWSE. Create a form with a grid instead. Then you can either put an editbox in the grid for the memo field, and/or you can set up doubleclick on the memo field to open another form that contains an editbox.

In my view, Browse has no place in a VFP application.

Tamar
 
Olaf seconded Tamar's good advice and I'll triple it.

Good Luck,
JRB-Bldr
 
If you think the Browse is so much easier, it's really just a grid in a window. Instead of SELECT alias and BROWSE you have a grid on a form and set it's recordsourcetype to alias and it
s recordsource to the alias, so it's actually only a tidbit of more work. Then you can do anything that you can do in a browse and more, eg you can add code to events like the click event of a columns control. With BROWSE you can only add coede via BINDEVENTS.

Add a grid class to your project and do anything you want in all grids into it, eg sorting columns, etc.

You gain much more control when using a control.

Bye, Olaf.
 
I know, I know. I use forms & grids 99.9% of the time, but I was still curious about how to do this. I guess it can't be done.
 
From your original post? No. The native text editor does not allow formatting text.

There are a bajillion other ways of displaying/formatting the contents of a memo field but none of them will come from a browse window and once formatting is involved it's no longer just text.
 
Actually, it can be done.

The name of the font is stored in the resource file (FOXUSER.*). You can determine the location of the file by calling SET("RESOURCE", 1).

Once you have the file, search for records with type = PREFW and ID = WINDMEMO. The record will contain a Data field, which in turn contains the font settings that you are looking for.

You can then programmatically modify the Data field so that it contains the font settings you want to use. However, I can't tell you how to do that. The Data field is a binary string, and you will have to figure out for yourself how the various items are stored within it.

Considering how difficult it is, it's not surprising that most of us prefer to use a grid rather than a browse.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top