Just got bit by the fact that vfp7 didn't object to a combobox object
being set to readonly within a method.

...turns out that doing so is ineffective and that the combobox will
still change the control source in that state <sigh>

So, on the surface, it seems as if the only direct option is to set the
combobox to .not. enabled.

However, that also precludes being able to view the combo box's
contents, so, wondering if there is an easy way to allow the user to
view the pulldown while preventing it from changing the control source?

Thanks in advance.
Beverly Howard

Re: combobox readonly? by David

David
Mon Sep 17 14:15:29 PDT 2007

I believe you want to change the style of the combo box to 2-Dropdown List
while leaving the control enabled and not read only.

Dave Tiffany

"Beverly Howard [Ms-MVP/MobileDev]" <BevNoSpamBevHoward.com> wrote in
message news:OW3qXxW%23HHA.5948@TK2MSFTNGP04.phx.gbl...
> Just got bit by the fact that vfp7 didn't object to a combobox object
> being set to readonly within a method.
>
> ...turns out that doing so is ineffective and that the combobox will still
> change the control source in that state <sigh>
>
> So, on the surface, it seems as if the only direct option is to set the
> combobox to .not. enabled.
>
> However, that also precludes being able to view the combo box's contents,
> so, wondering if there is an easy way to allow the user to view the
> pulldown while preventing it from changing the control source?
>
> Thanks in advance.
> Beverly Howard



Re: combobox readonly? by Beverly

Beverly
Mon Sep 17 16:36:05 PDT 2007

thanks... will give that a try

Beverly Howard

Re: combobox readonly? by Beverly

Beverly
Mon Sep 17 16:40:53 PDT 2007

>> I believe you want to change the style of the combo box to
2-Dropdown List while leaving the control enabled and not read only. <<

no joy... that was the setting that got me into trouble.

I do note that while the "Readonly" pulldown in properties offers a .T.
option it will not "take" and resets to .F. immediately after .T. is
selected.

Beverly Howard



Re: combobox readonly? by Stefan

Stefan
Mon Sep 17 23:17:18 PDT 2007


"Beverly Howard [Ms-MVP/MobileDev]" <BevNoSpamBevHoward.com> schrieb im
Newsbeitrag news:OW3qXxW%23HHA.5948@TK2MSFTNGP04.phx.gbl...
> Just got bit by the fact that vfp7 didn't object to a combobox object
> being set to readonly within a method.
>
> ...turns out that doing so is ineffective and that the combobox will still
> change the control source in that state <sigh>
>
> So, on the surface, it seems as if the only direct option is to set the
> combobox to .not. enabled.
>
> However, that also precludes being able to view the combo box's contents,
> so, wondering if there is an easy way to allow the user to view the
> pulldown while preventing it from changing the control source?

If the controlsource is always buffered, in combo.Valid() you
can do something like:
This.Value = OLDVAL(cField,cAlias)

If it's not always buffered, you can for example in combo.Init():
This.AddProperty('oldValue')
in combo.InteractiveChange()
This.oldValue = EVALUATE(This.ControlSource)
and in combo.Valid()
This.Value = This.oldValue


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------



Re: combobox readonly? by David

David
Tue Sep 18 09:52:15 PDT 2007

Sorry if I was unclear. I didn't mean to sugges that the combobox should be
set to read only.

Here's what I meant to say:

style = 2-Dropdown List
enabled=.T.
readonly=.F.


"Beverly Howard [Ms-MVP/MobileDev]" <BevNoSpamBevHoward.com> wrote in
message news:e1G$wQY%23HHA.2752@TK2MSFTNGP06.phx.gbl...
> >> I believe you want to change the style of the combo box to
> 2-Dropdown List while leaving the control enabled and not read only. <<
>
> no joy... that was the setting that got me into trouble.
>
> I do note that while the "Readonly" pulldown in properties offers a .T.
> option it will not "take" and resets to .F. immediately after .T. is
> selected.
>
> Beverly Howard
>
>



Re: combobox readonly? by Beverly

Beverly
Tue Sep 18 10:50:46 PDT 2007

>>
style = 2-Dropdown List
enabled=.T.
readonly=.F.
<<

That's what I have, but the form as a whole is "protected" in that I
have an "edit" button to preclude accidental data changes until the user
elects to make changes.

In the senario that came up, the user was browsing in the "Non Edit"
mode and wanted to see what categories where there since she couldn't
remember the one she wanted, and despite the fact that I had
programmically set the combo box to "read only" it took the lookup as an
edit and changed the record.

Using enabled=.f. achieves the protection but removes the ability for
the user to just look at the categories.

I can achieve what they need, but was primarily looking at why the "read
only" is not working so I understand it better.

Thanks for the info... it is helpful,
Beverly Howard


Re: combobox readonly? by Beverly

Beverly
Tue Sep 18 10:52:35 PDT 2007

>> can do something like:
This.Value = OLDVAL(cField,cAlias) <<

Thanks... think that is what I am looking for.

Beverly Howard

Re: combobox readonly? by Rush

Rush
Tue Sep 18 11:23:02 PDT 2007

Beverly Howard [Ms-MVP/MobileDev] wrote:
> >>
> style = 2-Dropdown List
> enabled=.T.
> readonly=.F.
> <<
>
> That's what I have, but the form as a whole is "protected" in that I
> have an "edit" button to preclude accidental data changes until the
> user elects to make changes.
>
> In the senario that came up, the user was browsing in the "Non Edit"
> mode and wanted to see what categories where there since she couldn't
> remember the one she wanted, and despite the fact that I had
> programmically set the combo box to "read only" it took the lookup as
> an edit and changed the record.
>
> Using enabled=.f. achieves the protection but removes the ability for
> the user to just look at the categories.
>
> I can achieve what they need, but was primarily looking at why the
> "read only" is not working so I understand it better.
>
> Thanks for the info... it is helpful,
> Beverly Howard
Not tested, but you might try saving the combobox value (to a form
property) in the .WHEN event, and then setting it back to that value in
the .VALID and/or the .INTERACTIVECHANGE events.

- Rush

Re: combobox readonly? by Beverly

Beverly
Tue Sep 18 12:12:35 PDT 2007

>> not tested <<

Thanks... still learning at an accelerated rate ;-)

Beverly Howard

Re: combobox readonly? by Anders

Anders
Tue Sep 18 15:20:08 PDT 2007

In just-looking mode, don't set a controlsource.
-Anders

"Beverly Howard [Ms-MVP/MobileDev]" <BevNoSpamBevHoward.com> wrote in
message news:ueSzxxh%23HHA.5840@TK2MSFTNGP03.phx.gbl...
> >>
> style = 2-Dropdown List
> enabled=.T.
> readonly=.F.
> <<
>
> That's what I have, but the form as a whole is "protected" in that I have
> an "edit" button to preclude accidental data changes until the user elects
> to make changes.
>
> In the senario that came up, the user was browsing in the "Non Edit" mode
> and wanted to see what categories where there since she couldn't remember
> the one she wanted, and despite the fact that I had programmically set the
> combo box to "read only" it took the lookup as an edit and changed the
> record.
>
> Using enabled=.f. achieves the protection but removes the ability for the
> user to just look at the categories.
>
> I can achieve what they need, but was primarily looking at why the "read
> only" is not working so I understand it better.
>
> Thanks for the info... it is helpful,
> Beverly Howard
>



Re: combobox readonly? by Yan

Yan
Tue Sep 18 18:00:01 PDT 2007

You could also make 2 objects, one is a textbox for the display or which is
bounded to your table, and a combobox for browsing/ listing purposes. Then
you could make the textbox readonly or disabled anytime and still be able to
let the users browse through the lists.

Just adjust the width of the combobox enough to see its pulldown button,
then you may use readonly/ enable property of the textbox as flags to when to
change the textbox's value.


Ryan Paradela



"Beverly Howard [Ms-MVP/MobileDev]" wrote:

> >> can do something like:
> This.Value = OLDVAL(cField,cAlias) <<
>
> Thanks... think that is what I am looking for.
>
> Beverly Howard
>

Re: combobox readonly? by Beverly

Beverly
Tue Sep 18 20:46:18 PDT 2007

>> In just-looking mode, don't set a controlsource. <<

another good one... thanks,
Beverly Howard


Re: combobox readonly? by Cy

Cy
Fri Sep 21 21:26:27 PDT 2007

It's just one of the facts of life that combo boxes cannot be set to
read-only. This is also true with HTML dropdowns as well. They can be
inactive, but read-only doesn't do anything.

--
Cy Welch
Senior Programmer/Analyst
MetSYS Inc.
http://www.metsysinc.com

"Beverly Howard [Ms-MVP/MobileDev]" <BevNoSpamBevHoward.com> wrote in
message news:Oe2pffi#HHA.2004@TK2MSFTNGP06.phx.gbl...
> >> not tested <<
>
> Thanks... still learning at an accelerated rate ;-)
>
> Beverly Howard