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!

Combo Box for Fixed Options

Status
Not open for further replies.

newtofoxpro

Programmer
Sep 16, 2007
301
0
0
IN
I am looking for Control which manage Fixed Options to select by user. I found ComboBox is nearly do the job.

Example 1. " Do you want to continue... Yes,No"
Example 2. Debit,Credit followed by Amount.
Example 3. ReportType = Compact,Detail,Summary

I used ComboBox with
this.RowSourceType = 1
this.RowSource = "Debit,Credit"
this.Style = 2

Example 3. Experienced User knows this option, when user wants ReportType Compact user press <C> and <Enter> I want ComboBox should select Compact and move to next control without opening list.

Novice user may not knows so he would enter <X> then ComboBox should open the list to select options.

Please advice any other control to do this job.
 
Ah, thanks newtofoxpro.

I never did fox for DOS, so that's a setting I never use, I only know it from having read the topic on all SET commands, but of course keep it at it's default.

Bye, Olaf.
 
As @mjcmkrsr advised InputMask & Format in textbox, I am using like

InputMask = "Yesyes,Nono"
Format = "M"

but this appear as YesYes & NoNo

Is there any specific reason ?
 
I don't know, but Format help topic says about M: Included for backward compatibility. It's not documented anymore, what this does under which circumstances, so I can only guess why the secondary Y or N are capitalized. Why double the words anyway?

Bye, Olaf.

 
Sorry, My example was wrong

this.InputMask = "Station,Outstation"
this.Format = "M"

this appear as StAtioN & OUtstAtioN
 
Format "M" was what we had before we had combo boxes. It allowed you to offer a pre-defined choice of values, just like we now do with a combo box. There's no point in using a Format of "M" with a combo box.

The nearest modern equivalent is to set the combo's RowSourceType to 1, and set the Rowsource to a comma-delimited list of the required values (which is exactly what you did in your original code).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 

I am using it with TextBox as Mark(mjcmkrsr) advised.
 
I am using it with TextBox as Mark(mjcmkrsr) advised.

OK, but it's still "backward compatibilty only". A combo box is the preferred alternative to a textbox with Format "M".

You probably have a good reason for not using a combo box, but I would have to read this entire thread again go find out. I don't have time to do that right now. Sorry.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I can't reproduce that problem.

_screen.AddObject("t1","textbox")
_screen.t1.Visible = .t.
_screen.t1.Format="M"
_screen.t1.Inputmask="Credit,Debit"
_screen.t1.Inputmask="Station,Outstation"

Works flawless in both situations.

Anyway, like Mike said you would rather use a combo with rowsourcetype=1 (value). We've been all through this. And we'll end up the same way again.

Bye, Olaf.
 
WE were at solcing this iwth combox and SET KEYCOMP TO WINDOWS, weren't we?

If you need SET KEYCOMP TO DOS for most of your application and want SET KEYCOMP TO WINDOWS for solving the combobox behaviour you can do so.

In combo.when SET KEYCOMP TO WINDOWS, in combo.valid SET KEYCOMP TO DOS, or use GotFocus() And LostFocus() events.

Done, isn't it?

Bye, Olaf.
 
I never thought order of the properties would generate problem
_screen.t1.Format="M"
_screen.t1.Inputmask="Station,Outstation"
OR
_screen.t1.Inputmask="Station,Outstation"
_screen.t1.Format="M"
Thanks you have solved.


Yes.
 
To me it seems very natural to first set format, as the inputmask meaning is totally different in the normal case. It should also not matter, if you set this in the property sheet of a textbox in the designer, then you set both properties "at the same time", during runtime they will both be set by loading the textbox object, even before it's Init.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top