[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Use of DbGrid and a DbCheckbox

Posted on 2002-05-24
4
Medium Priority
?
504 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 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