🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #186

TwwDBGrid and ALT key

#186
From: S
Date: Thu, 18 Mar 2004 21:18
65 lines
2909 bytes
Hello, It looks like I have run into some unknown glitch in retrieving
data
via the ibdataset FieldByName method from a TwwDBGrid, and it's
associated with the ALT key.

Specifically:  

When I hit a Save button on this form, I have a validation routine
loop
through all of the row (records) in the grid, and this works properly.

(if both fields of all the records are filled in by user, it will 
loop through all records, and line number 12 below *wont* 
gets executed.)

But if I do not click on the button, and instead use the keyboard,
using the ALT-S combo for the button (I put a "&" in the 
name property for the button), somehow the sString2 value
below comes up empty evey time. ( line 10)

 ... As if somehow, the ALT key clears the Description field
internally
even though there is clearly text in there.


portion of Save button handler:

------------------
while not ibdsCustomer.EOF do
      begin
        sString1 := ibdsCustomer.FieldByname('Customer_ID').AsString;
        sString2 := ibdsCustomer.FieldByName('DESCRIPTION').AsString;
        if (Trim(sString1) = '') and (Trim(sString2) = '') then
           ibdsCustomer.Delete
        else
           ibdsCustomer.Next;

10.   if (Trim(sString1) <> '') and (Trim(sString2) = '') then
11.      begin
12.          bIncompleteDesc := True;
13.      break;
        end;
      end;
------------------

Note: 
 I made sure to clear all colEnter handlers or other properties of the
TwwGrid that would be
causing problems.

A sequential 'Use-Case' description would be:

-You have a two column grid.
-User has focus on third record of grid, (2 recs exist)
-Enters a value in first column,
-Hits Tab
-Enters a value in second column
-Hits ALT-S on kbrd
-"sString2 := ibdsCustomer.FieldByName('DESCRIPTION').AsString"
        gets executed.
-sString2 is empty (whereas by clicking Save button, it has
                      a value).

Any suggestions welcome, 
Steve
Technical Details
Message-ID: <98682b82.0403181318.86e2747@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews2.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb0ea,261f03bbc751251a,start
X-Google-Attributes: gidfb0ea,public
X-Google-Thread: f94dd,261f03bbc751251a,start
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2004-03-18 13:18:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews2.google.com!not-for-mail
From: steveb428@hotmail.com (S)
Newsgroups: borland.public.delphi.nativeapi,borland.public.delphi.vcl.components.using
Subject: TwwDBGrid and ALT key
Date: 18 Mar 2004 13:18:36 -0800
Organization: http://groups.google.com
Lines: 65
Message-ID: <98682b82.0403181318.86e2747@posting.google.com>
NNTP-Posting-Host: 207.168.250.66
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1079644716 7826 127.0.0.1 (18 Mar 2004 21:18:36 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 18 Mar 2004 21:18:36 +0000 (UTC)