?
Solved

Use of DbGrid and a DbCheckbox

Posted on 2002-05-24
4
Medium Priority
?
503 Views
Last Modified: 2007-12-19
I think there is a possiblity to use dbcheckbox upon a dbgrid. Unfortunatelly the code herefore on the web is partly unusable because in D5 the OnDrawDataCel event has become obsolete (see gnomehome, uddf f.i.).

I wonder if anybody has good code to use a dbcheckbox on a dbgrid ?

Second question : some columns are read only, in the dbgrid. With tab you go to this cel, but I don't want to (is ugly...). How can I avoid the tabstop on a readonly cel ?

Third question on this grid :
I would like to "freeze" the two first columns, when scrolling to the right, as in Excel or Access...
Phil
0
Comment
Question by:PhilWillems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
nestorua earned 225 total points
ID: 7033191
HI, Phil,
As for the first question: if you mean to use dbcheckbox exactly in those cells which correspond to the boolean fields,
you don't need dbcheckbox - you can use checkbox covering the selected cell of corresponding type and hiding when the selected cell is of another type, that's all.
As for the second question: the following code skeep the column corresponding to the Field with name "SIZE"
(use OnColEnter event of your DBGrid):
procedure YourDBGridColEnter(Sender: TObject);
begin
if YourDBGrid.SelectedField.FieldName='SIZE'
 then SendMessage(YourDBGrid.Handle, WM_KEYDOWN, VK_TAB, 0);
end;
As for the third question: simply use two dbgrids instead of
one if you don't want to override the DBGrid essentially.
Sincerely,
Nestorua.
0
 

Author Comment

by:PhilWillems
ID: 7036836
Solution 2 and 3 : magnificent. Very goor solutions.

Solution 1 :
I'm not such an expert and I can't help myself.
Some code would help.

filip.willems@advalvas.be
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7037390
HI, Philip,
Still try to do it by yourself, I only help you with some advice (It's much more useful than simply having ready answer).
1.Put CheckBox on the form with DBGrid on it.
2.In OnDrawColumnCell of the DBGrid check if your Field of the required type.
If so, show and move the CheckBox on the Selected Cell (changing the Left, Top, ... properties of the CheckBox and maybe use BringToFront method).
If not, hide the CheckBox.
Sincerely,
Nestorua.
0
 

Author Comment

by:PhilWillems
ID: 7038896
Still trying for several hours but only loosing my hair.
Since in this event FIELDS no longer exists I suppose I have to work with Grid.SelectedField.FieldName but I don't get any wright thing because this Field remains the same when the grid is build.(my first column).
Otherwise I have to work with fields[index] but that is not really an option, because columns can be removed, added, position changed,....
I might give up, but then my application will never be what I wanted it to be....
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question