Playing with combo box flags...

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
G.Grigioni

Playing with combo box flags...

Post by G.Grigioni » 12 Mar 2008, 10:19

 Posted by:  G.Grigioni 

I've spent a lot of time looking for a solution to the attached sample.
The need is to have a combo box that when is ON (the term editable could
generate some confusion...) the user can select a item of the list but
he can't select the text for copy & paste, nor scroll to see the end of
the selected text (I use the last chars of the string to save some
informations not viewable for the user: FK IDs...).
When the combo is OFF, the item selected can't be changed by the user
but also the text color of the item must be black and not grayed (text
of disabled standard combo box is not very easy to read for some users).

The sample is written in TD 3.0 (ptf4)

Thank you very much for any suggestion

GG
You do not have the required permissions to view the files attached to this post.

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2370
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Playing with combo box flags...

Post by Jeff Luther » 12 Mar 2008, 18:08

 Posted by:  Jeff Luther 

You may get an elegant solution to your issue, GG (*great* and clear
example, BTW! Easy to understand and see what you want), but one
solution might be to have those CBs as a matched pair. When OFF cmb1 is
shown and when ON cmb2 is shown, and opposite one is hidden.

Place them on the form so they exactly overlap and use the option
buttons to show/hide each correctly, depending on whether OFF or ON.
Meanwhile, each CB has a duplicate listing of its entries.

I haven't seen a better solution ever, but I did this once, only for a
pair of multiline fields one time that had to have word-wrap on or off.

If you have 50 CBs you want to do this for, tougher to implement, though
I'd think most of the code mgmt. could be done with a set of classes: a
funct. (or gen. win.) class for the 'global' work, a pair of CB classes
to define OFF vs. ON. Just a thought...

Best Regards,
Jeff @ PC Design
info. & samples: www.JeffLuther.net/unify/

G.Grigioni

Re: Playing with combo box flags...

Post by G.Grigioni » 12 Mar 2008, 18:10

 Posted by:  G.Grigioni 

Jeff Luther ha scritto:

Thank you Jeff for your suggestions, I will use this solution if I
coundn't approach another "elegant" way to solve the problem.

Best regards

Gianluigi

James McCall

Re: Playing with combo box flags...

Post by James McCall » 13 Mar 2008, 19:45

 Posted by:  James McCall 

The attached file does what you want, I think (saved as CTD2000, text).

Unfortunately the user sees the list flicker the first time the combo box is
clicked when disabled. You could avoid this by allowing the user to drop
the list down but not select (you can disable the list part independently
from the who combo control). However you have to trap SAM_SetFocus and
record the current value; and trap SAM_Click to set the value back to your
SAM_Focus value. Once you head down that road you are setting yourself up
for a lot of work because you'll want to code around all the other
deficiencies of the TD combo box!

James

You do not have the required permissions to view the files attached to this post.

G.Grigioni

Re: Playing with combo box flags...

Post by G.Grigioni » 14 Mar 2008, 09:45

 Posted by:  G.Grigioni 

James McCall ha scritto:

Thank you for the sample and the suggestions, I'm working on it.

GG

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ccbot] and 0 guests