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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Messages in another language 2

Status
Not open for further replies.

SitesMasstec

Technical User
Sep 26, 2010
502
BR
How to define the language for VFP 9 messages?

For example, after closing a memo window with the Esc key, instead of receiving the message "Discard Changes ?" I would like to receive the message in French.

I wrote the command SYS(3006, 1036) in my application, but the message continues to be shown in English language.

Thank you,
SitesMasstec
 
The setting you tried is about ActiveX. A sample of that is given in the help topic on the related SYS(3005), which shows you can automate Excel with german object model methods, eg "Beenden" instead of Quit.

The resource strings of a few default messages and captions of eg Messagebox buttons (Yes/No => Oui/No) are determined by the resource runtime DLL used, eg vfp9rfra.dll and you specify that with command line switch -Lvfp9rfra.dll, the default is taking the language corresponding to the OS, provided the language resource DLL is present.

You can't switch that at runtime, so eg you live with messagebox button captions or roll your own messagebox.

I don't know where "Discard Changes ?" is really coming from, not sure it's a resource file text.

Bye, Olaf.
 
Hi Olaf!

My program (.PRG fie) opens a Memo field for the user to type text.

After typing some text in that field ("blah blah blah, etc") if the user press down Ctrl + W keys the program saves the text and finishes, but if the user press the Esc key (for not saving his/her text) VFP alerts "Discard changes ?".

I want the VFP presents such alerts in another language.

Thank you,
SitesMasstec
 
Well, I answered that. If that message is coming from the VFP runtime, it's language is defined by the resource file used.

So for french mssages you have to start yourapp.EXE -Lvfp9rfra.dll to get the corresponding french message.

If you only have source code this always uses the messages in Vfp9.exe and that only is english. So make an EXE out of your PRG.

Bye, Olaf.
 
A WAIT WINDOW will display whatever text you want it to.

If you want it to ALWAYS display French, then just have it display "Annuler les modifications ?" (or whatever).

Example:
Code:
WAIT WINDOW "Annuler les modifications ?" TIMEOUT 2

If you somehow want to have the WAIT WINDOW message change languages then merely define the message before issuing the command.

Example:
Code:
* --- Somehow determine which language to use --
DO CASE
   CASE Lang = "FRENCH"
       cWaitMsg = "Annuler les modifications ?"
   CASE Lang = "SPANISH"
       cWaitMsg = "Descartar los cambios ?"
   OTHERWISE
       cWaitMsg = "Discard changes ?"
ENDCASE
WAIT WINDOW cWaitMsg TIMEOUT 2

Good Luck,
JRB-Bldr

 
Hi!

The command I use to open a window for the user to edit a text is:

MODIFY MEMO COBS2 WINDOW JanelaGravaObs IN WINDOW TelaPadrao2

Thanks,
SitesMasstec
 
Hello!

Well, I am trying another approach ro the problem:

My file has a Memo field called COBS2

I created a form and put on it the Edit text box called MyHistory

Executing the program: after writing in the Edit Box ('MyHistory'), I want to save the text, so I wrote the command:
REPLACE COBS2 WITH MyHistory
but the contents of MyHistory is not saved in the COBS2 field

Thank you,
SitesMasstec

 
For a start, you can't replace a memo field with an edit box. You need to specify the contents of the edit box:
[tt]
REPLACE CobS2 WITH THISFORM.MyHistory.Value[/tt]

But, better still, simply bind the edit box to the memo field. To do that, set its the edit box's ControlSource property to MyTable.CobS2. Then you won't need to do the REPLACE.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello Mike!

Nice, it worked well.

I had already used 'edit box's ControlSource property to MyTable.CobS2' earlier and it worked fine BUT later I decided not to use it because the user may change the contents of the text and realize he/she may not have changed it and would like to quit without saving!

So the form will have two buttons: 'Save and quit' and 'Quit without saving'

For 'Save and quit' I tried your command (REPLACE CobS2 WITH THISFORM.MyHistory.Value) and it worked fine

For 'Quit without saving' it will do nothing

But I also need to put the initial content of the Memo field CobS2 in the Edit box! How do I do it?

Thank you,
SitesMasstec
 
Hello!

Well, I used in the Form, Init the following:

THISFORM.YCOBS2.Value=clientes.COBS2

and it load the contents of the Memo field COBS2 to the Edit Box.

Thank you,
SitesMasstec
 
Mike already told you how to have the Editbox display the memo field content. Set the ControlSource.

To allow your user to make changes and then abandon, use buffering. Set the Buffermode property of your form to 2-Optimistic. If you're using the Data Environment, set the BuffermodeOverride property of the table to 5-Optimistic table buffering. If you're opening tables in the Load method instead, use the CursorSetProp method to set table buffering. Also, early in the Load method, make sure you have SET MULTILOCKS ON.

Now, your Save and Quit button's Click method should have:

Code:
TableUpdate(.T., .T., "<alias for your table>")

and the Quit without saving button's Click method should have:

Code:
TableRevert(.T., "<alias for your table>")

Tamar
 
Yes, Tamar, the advice of Mike worked well:
... set its the edit box's ControlSource property to MyTable.CobS2

but I prefered to use his' REPLACE CobS2 WITH THISFORM.MyHistory.Value to save the contents of the EditBox to the Memo field in the file.

Reversely, to read the contents of the Memo field and put them in the EditBox, I used:
THISFORM.MyHistory.Value=CobS2

Of course the use of ControlSource and Table Update/Table Reverse is another solution.

So, the problem was solved, thank you all.

SitesMasstec
 
It's fine you now rather use an editbox to let users edit a memo field, that's what it's meant for and MODIFY MEMO is not a really good user interface, but you seem to either only use the PRG yourself or distribute it to others with VFP installed.

You know you can distribute EXE + Runtime + DBFs royalty free to anyone?

It's very simple to build an EXE, even and especially based on just one PRG. You CREATE PROJECT, you drag in your prg file from explorer, then click the build button in the project manager window and choose to compile an EXE.

And instead of doing this its also just two lines of code:
Fox Wiki said:
build project foo from foo.prg
build exe foo from foo
(see
Bye, Olaf.
 

Hi Olaf!

Yes, I distribute my application in 'the EXE + Runtime + DBFs royalty free form' using the Project / Build button you mentioned.

The application is then packed in InstallShield Setup files (the InstallShield Limited Edition which comes along in the VFP 9 package), so to facilitate for users to install the applications. My users don't have VFP installed in their machines.

I have made extensive use of PRG files in my applications, as well as, Forms, Reports and Labels. Most of my PRGs do calls to Forms, Reports and Labels. I feel confortable using this approach.

Even as Microsoft has stopped releasing new versions of VFP, I think the VPF 9 is enough for 10 years more, except for integrating PDF in it.

Thank you,
SitesMasstec


 
Then a solution without changing anything else would have been specifying the vfp9rfra.dll

As you use Installshield, you find Merge Modules for the language resource DLLs and you find the DLLs in C:\Program Files (x86)\Common Files\Microsoft Shared\VFP
The resource dlls also contain graphics and eg CMONTH() will give you month names in other languages, if you distribute these DLLs or Merge Modules with your setup.
Scroll far down to "To include a localized Visual FoxPro resource file" in
Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top