If you add an empty value in your fillusing array like this (the key
is char 5, so no key selected = space(5):
AAdd(aValues,{"",Space(5)})
it will show correctly -when encountering an empty key- the empty
value when using drop down, but it will incorrectly show you the last
displayed value (empty or whatever was in the last record) when using
a drop down list!
When using
AAdd(aValues,{"---",Space(5)})
it will display the --- when it should do so.
Ok, solved for me. Out of curiosity: is this a Windows (2K) bug or a
Cavo bug?
Dick van Kooten
Neither. The behaviour under W2K is consistant, predictable, and
importantly, logical.
I actually consider it to be incorrect behaviour under W9x that has been
rectified in W2K.
--
g.
Gary Stark
gst...@RedbacksWeb.com
http://RedbacksWeb.com
Hello Gary,
That's an interesting opinion. I add an empty value to be displayed
when I've got an empty key, W2K display this as I expect with a drop
down but leaves the value of the prior displayed record when I change
it to a drop down list. You call that is consistant, predictable, and
logical?????
I'll think I should hire you in the future to explain to my customers
that it's perfectly logical to see wrong values! My customers
consider this a bug and I consider it a bug too.
Dick
"Drs. D.J.W. van Kooten" wrote:
> >Neither. The behaviour under W2K is consistant, predictable, and
> >importantly, logical.
>
> Hello Gary,
>
> That's an interesting opinion. I add an empty value to be displayed
> when I've got an empty key, W2K display this as I expect with a drop
> down but leaves the value of the prior displayed record when I change
> it to a drop down list. You call that is consistant, predictable, and
First of all, I only use dropdown lists, and secondly, I do not ever see
the problem that you see. While I don't support W9x any longer, the
behaviour that I see is not what you're describing. Please show us some
code.
The behaviour and results that I get are predictable and reliable.
Oh yes, what do you call an "empty key"?
And if you're linking your combo to a table - I don't know if you are -
I'm simply asking the question incase it's appropriate, as it sounds like
it might be - but there's no match for a given key and that key is
selected, what do you think it should be displaying?
>
> logical?????
>
> I'll think I should hire you in the future to explain to my customers
> that it's perfectly logical to see wrong values! My customers
> consider this a bug and I consider it a bug too.
>
> Dick
--
>Oh yes, what do you call an "empty key"?
Hello Gary,
Below is the esseence of the code - it fills an array with contents of
a database and the field key contains a 5 character key value to that
database . If the user does not select a value, that key remains empty
(space 5) and by adding an empty value linked to space 5 in the array,
I get an empty listbox when the key is empy....until I use drop down
list, then it shows me, when I skip through the data, the last
displayed value (which can be empty, until one of the records has a
value). The second alternative works, when I show "---" on an empty
key. I keep thinking this is not what it should be.
METHOD FillComboBox()
LOCAL oObj AS OBJECT
LOCAL a:={} AS ARRAY
oObj:=Data{}
DO WHILE !oObj:eof
AAdd(a,{oObj:FIELDGET(#description),oObj:FIELDGET(#key)})
oObj:SKIP()
ENDDO
AAdd(a,{"",Space(5)}) // this does NOT work
AAdd(a,{"---",Space(5)}) // this works
oObj:CLOSE()
RETURN a
(oDCmPers1:Fillusing(SELF:FillComboBox()) links the control to the
array).
>And if you're linking your combo to a table - I don't know if you are -
>I'm simply asking the question incase it's appropriate, as it sounds like
>it might be - but there's no match for a given key and that key is
>selected, what do you think it should be displaying?
So, it should display nothing, as I put AAdd(a,{"",Space(5)}) in the
code. Don't you agree with that? I mean, the work around works fine
too, but when the original solution does not work in drop down list, I
consider this a bug in W2K or Cavo.
Dick
> If you add an empty value in your fillusing array like this (the key
> is char 5, so no key selected = space(5):
>
> AAdd(aValues,{"",Space(5)})
try AAdd(aValues,{" ",Space(5)})
this should work
Chris
Ok ... I'm not understanding one thing here ...
"Drs. D.J.W. van Kooten" wrote:
On Tue, 01 Jul 2003 08:56:33 +1000, Gary Stark
<3062...@RedbacksWeb.com> wrote:>Oh yes, what do you call an "empty key"?
Hello Gary,
Below is the esseence of the code - it fills an array with contents of
a database and the field key contains a 5 character key value to that
database .
In the combobox. Fine; no worries so far ...
If the user does not select a value,
In the combobox ...
that key remains empty
Ok ...
(space 5) and by adding an empty value linked to space 5 in the array,
Actually, have you tried adding a single space as the text value, rather
than an empty value?
I get an empty listbox when the key is empy....until I use drop down
No, not quite ... you get an apparently blank combobox item ...
list, then it shows me, when I skip through the data, the last
Which data are you skipping through here? This is where I'm lost.
Are you saying that this is when you're selecting an item in the combobox, and it refuses to permit you to select an empty item once an item has been selected, or are you saying that once an item has been selected, (and that item has then referenced an item in the table it's the key to) it fails to dereference the pointer to that table?
Or all of the above? <g>
If you say that it's failing to dereference the pointer from the selected key value into the table, I would suggest that, failing the existence of record with an empty key value in that table, that may well be the expected, if not desirable, behaviour. This might sound like a strange thing to say, but if there's no empty key, perhaps there's nowhere for your combobox value to go.
But as you can see it's not yet clear to me what (exactly) it is that you're doing.
What's in the ListBoxSelect method ?
displayed value (which can be empty, until one of the records has a
value). The second alternative works, when I show "---" on an empty
key. I keep thinking this is not what it should be.
But it is what you're putting in there. If you want a blank value,
put one in:
METHOD FillComboBox()
LOCAL oObj AS OBJECT
LOCAL a:={} AS ARRAY
oObj:=Data{}DO WHILE !oObj:eof
AAdd(a,{oObj:FIELDGET(#description),oObj:FIELDGET(#key)})
oObj:SKIP()
ENDDO
AAdd(a,{"",Space(5)}) // this does NOT work
Try this line instead :
AAdd(a,{" ",Space(5)})
Actually, look at what follows; you might find this sort of code is slightly better. While I certainly do what you're doing here, assigning the size of the array before you use it will prevent a bit of memory thrashing that the constant AAdd() calls will be causing you. While it's probably not noticeable in the normal scheme of things, this sort of coding style should be quicker as well.
oObj := Data{}
nItems := oObj:Reccount + 1
a := ArrayNew( nItems )
a[ 1 ] := { " ", " "
}
oObj:GoTop()
i := 2
While !oObj:EOF
a[ i ] := { oObj:FieldGet(
#Description), oObj:FieldGet( #Key ) }
i += 1
oObj:Skip()
end
oObj:Close()
self:ODCMyCombo:FillUsing( a )
(oDCmPers1:Fillusing(SELF:FillComboBox()) links the control to the
array).
Well, as I understand it, it's not actually a link between the array
and the control.You're actually stuffing the array elements into the combobox
items. Of course, this could just be semantics, and I'm not overly concerned
here, but I do think it's important to make sure that we both understand
what we think the other is saying.
>And if you're linking your combo to a table - I don't know if you are -
>I'm simply asking the question incase it's appropriate, as it sounds like
>it might be - but there's no match for a given key and that key is
>selected, what do you think it should be displaying?So, it should display nothing, as I put AAdd(a,{"",Space(5)}) in the
"Nothing", or an apparently blank textvalue? :)
code. Don't you agree with that? I mean, the work around works fine
too, but when the original solution does not work in drop down list, I
consider this a bug in W2K or Cavo.
In the code you're presenting, you're not actually putting a blank
value into the textvalue of the combobox; you're really putting "nothing"
in there. It's subtle, and to an end user it might look the same, but it's
not. I'm curious as to what happens when you put a single (or more) space
into the textvalue.
And also, IIRC, you said that you were using an ordinary combobox rather
than a dropdown list. Was this only as a workaround for this issue, or
was there another reason for this?
On Tue, 01 Jul 2003 07:20:47 GMT, koo...@ic2remove.this.com (Drs.
D.J.W. van Kooten) wrote:
>AAdd(a,{oObj:FIELDGET(#description),oObj:FIELDGET(#key)})
> oObj:SKIP()
> ENDDO
> AAdd(a,{"",Space(5)}) // this does NOT work
You should avoid null strings in the displayed text on a combobox.
I've seen weird behaviour with that, including some strange 5333's.
Regards,
Amilcar A. Camargo F.
Sand, S. A.
Guatemala, C. A.
(pls remove leading underscore to e-mail)
Hello Gary, Amilcar, Chris,
Thanks for your extensive remarks. I believe you are correct asuming
that adding " " to match the empty values works; I already found out
that adding "--" works as well. But, to briefly go through Gary's
remarks :
>Actually, have you tried adding a single space as the text value, rather than
>an empty value?
Well, I added "--" and this works. But still, I would expect
Windows/Cavo to display nothing with a "", as it does correctly in the
drop down combobox.
>No, not quite ... you get an apparently blank combobox item ...
No, blank is blank (as when using drop down) and not the old value (as
when using the drop down list).
>Which data are you skipping through here? This is where I'm lost.
The current data in the database. In some records, a value has been
entered and in some not. Those empty values should point to the empty
addition in the array...
>
>Are you saying that ....
>Or all of the above? <g>
So, none of the above...
>What's in the ListBoxSelect method ?
It fills an hour price in another field, depending on the selection.
This works fine.
>
>Try this line instead :
> AAdd(a,{" ",Space(5)})
I am sure it works...
>Actually, look at what follows; you might find this sort of code is slightly
>better. While I certainly do what you're doing here, assigning the size of the
>array before you use it will prevent a bit of memory thrashing that the
>constant AAdd() calls will be causing you. While it's probably not noticeable
>in the normal scheme of things, this sort of coding style should be quicker as
>well.
Thanks for this tip, I will do some rewriting!
>Well, as I understand it, it's not actually a link between the array and the
>control.You're actually stuffing the array elements into the combobox items.
That's right.
>
>"Nothing", or an apparently blank textvalue? :)
The latter.
>
>In the code you're presenting, you're not actually putting a blank value into
>the textvalue of the combobox; you're really putting "nothing" in there. It's
>subtle, and to an end user it might look the same, but it's not. I'm curious
>as to what happens when you put a single (or more) space into the textvalue.
The reason I am concerned is that it works fine with a drop down and
NOT with a drop down list. As Amilcar already wrote, empty values also
can lead to 5333, so tehere is definitely something weirds around
this.
>And also, IIRC, you said that you were using an ordinary combobox rather than
>a dropdown list. Was this only as a workaround for this issue, or was there
>another reason for this?
That's a long story. I always thought, that a drop down list did not
allow typing several characters to get closer to the required item. I
thought that pressing A and then B would redisplay, starting with a B.
But recently, a customer <g> told me that this indeed happens when you
pause a while, but not when you type quick. So as soon as I knew that,
I replaced my drop downs with the drop down lists. With the above
result.
Anyhow, thanks for your reaction - it should be useful for others as
well.
Dick van Kooten
>
>
>--
>g.
>Gary Stark
>gst...@RedbacksWeb.com
>http://RedbacksWeb.com
>
>
>--------------E13811F97F7604DEE8FC64D7
>Content-Type: text/html; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
><html>
>Dick,
><p>Ok ... I'm not understanding one thing here ...
><p>"Drs. D.J.W. van Kooten" wrote:
><blockquote TYPE=CITE>On Tue, 01 Jul 2003 08:56:33 +1000, Gary Stark
><br><3062...@RedbacksWeb.com> wrote:
><p>>Oh yes, what do you call an "empty key"?
><p>Hello Gary,
><p>Below is the esseence of the code - it fills an array with contents
>of
><br>a database and the field key contains a 5 character key value to that
><br>database .</blockquote>
>In the combobox. Fine; no worries so far ...
><br>
><br>
><blockquote TYPE=CITE>If the user does not select a value,</blockquote>
>In the combobox ...
><br>
><blockquote TYPE=CITE>that key remains empty</blockquote>
>
><p><br>Ok ...
><br>
><blockquote TYPE=CITE>
><br>(space 5) and by adding an empty value linked to space 5 in the array,</blockquote>
>Actually, have you tried adding a single space as the text value, rather
>than an empty value?
><br>
><blockquote TYPE=CITE>I get an empty listbox when the key is empy....until
>I use drop down</blockquote>
>No, not quite ... you get an apparently blank combobox item ...
><blockquote TYPE=CITE>
><br>list, then it shows me, when I skip through the data, the last</blockquote>
>
><p><br>Which data are you skipping through here? This is where I'm lost.
><p>Are you saying that this is when you're selecting an item in the combobox,
>and it refuses to permit you to select an empty item once an item has been
>selected, or are you saying that once an item has been selected, (and that
>item has then referenced an item in the table it's the key to) it fails
>to dereference the pointer to that table?
><p>Or all of the above? <g>
><p>If you say that it's failing to dereference the pointer from the selected
>key value into the table, I would suggest that, failing the existence of
>record with an empty key value in that table, that may well be the expected,
>if not desirable, behaviour. This might sound like a strange thing to say,
>but if there's no empty key, perhaps there's nowhere for your combobox
>value to go.
><p>But as you can see it's not yet clear to me what (exactly) it is that
>you're doing.
><p>What's in the ListBoxSelect method ?
><br>
><br>
><blockquote TYPE=CITE>displayed value (which can be empty, until one of
>the records has a
><br>value). The second alternative works, when I show "---" on an empty
><br>key. I keep thinking this is not what it should be.</blockquote>
>
><p><br>But it is what you're putting in there. If you want a blank value,
>put one in:
><blockquote TYPE=CITE>
><p>METHOD FillComboBox()
><br>LOCAL oObj AS OBJECT
><br>LOCAL a:={} AS ARRAY
><br> oObj:=Data{}
><p> DO WHILE !oObj:eof
><p>AAdd(a,{oObj:FIELDGET(#description),oObj:FIELDGET(#key)})
><br>
>oObj:SKIP()
><br> ENDDO
><br> AAdd(a,{"",Space(5)})
>// this does NOT work</blockquote>
>
><p><br>Try this line instead :
><p><tt> AAdd(a,{" ",Space(5)})</tt>
><br>
><p>Actually, look at what follows; you might find this sort of code is
>slightly better. While I certainly do what you're doing here, assigning
>the size of the array before you use it will prevent a bit of memory thrashing
>that the constant AAdd() calls will be causing you. While it's probably
>not noticeable in the normal scheme of things, this sort of coding style
><i>should</i> be quicker as well.
><p><tt> oObj := Data{}</tt><tt></tt>
><p><tt> nItems := oObj:Reccount + 1</tt>
><br><tt> a := ArrayNew( nItems )</tt>
><br><tt> a[ 1 ] := { " ", " "
>}</tt>
><br><tt> oObj:GoTop()</tt>
><br><tt> i := 2</tt>
><br><tt> While !oObj:EOF</tt>
><br><tt> a[ i ] := { oObj:FieldGet(
>#Description), oObj:FieldGet( #Key ) }</tt>
><br><tt> i += 1</tt>
><br><tt> oObj:Skip()</tt>
><br><tt> end</tt>
><br><tt> oObj:Close()</tt><tt></tt>
><p><tt> self:ODCMyCombo:FillUsing( a )</tt>
><p>
><blockquote TYPE=CITE>(oDCmPers1:Fillusing(SELF:FillComboBox()) links the
>control to the
><br>array).</blockquote>
>
><p><br>Well, as I understand it, it's not actually a link between the array
>and the control.You're actually stuffing the array elements into the combobox
>items. Of course, this could just be semantics, and I'm not overly concerned
>here, but I do think it's important to make sure that we both understand
>what we think the other is saying.
><br>
><blockquote TYPE=CITE>>And if you're linking your combo to a table - I
>don't know if you are -
><br>>I'm simply asking the question incase it's appropriate, as it sounds
>like
><br>>it might be - but there's no match for a given key and that
>key is
><br>>selected, what do you think it should be displaying?
><p>So, it should display nothing, as I put AAdd(a,{"",Space(5)}) in the</blockquote>
>
><p><br>"Nothing", or an apparently blank textvalue? :)
><blockquote TYPE=CITE>
><br>code. Don't you agree with that? I mean, the work around works fine
><br>too, but when the original solution does not work in drop down list,
>I
><br>consider this a bug in W2K or Cavo.</blockquote>
>
><p><br>In the code you're presenting, you're not actually putting a blank
>value into the textvalue of the combobox; you're really putting "nothing"
>in there. It's subtle, and to an end user it might look the same, but it's
>not. I'm curious as to what happens when you put a single (or more) space
>into the textvalue.
><p>And also, IIRC, you said that you were using an ordinary combobox rather
>than a dropdown list. Was this only as a workaround for this issue, or
>was there another reason for this?
><br>
><p>--
><br>g.
><br>Gary Stark
><br>gst...@RedbacksWeb.com
><br><A HREF="http://RedbacksWeb.com">http://RedbacksWeb.com</A>
><br> </html>
>
>--------------E13811F97F7604DEE8FC64D7--
>
Perhaps some of the confusion is due to the default value of an empty field.
Create a small table with one field of each type and append a blank record.
Viewing that record with a hex editor you will note that the fields are
filled with the space character. Thus a space is a valid entry and
null_string is not. I am aware that this does not address the fact that the
dropdown list behaves differently than the combobox, but as they are
intended to be used slightly differently that is to be expected.
Ed