BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do you change dbGrid options at runtime

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Steve
Guest





PostPosted: Thu Oct 28, 2004 5:02 am    Post subject: How do you change dbGrid options at runtime Reply with quote




I want to place a button on my form.
I want the button to allow me to change
the dbgrid options to what I wish after the
form is running. How do I do that?


Back to top
Newsreader
Guest





PostPosted: Thu Oct 28, 2004 6:22 am    Post subject: Re: How do you change dbGrid options at runtime Reply with quote



As, you never spacify what you want to change, it's to broad to explain. I'd
suggest you read the full documentation of TDBGrid in the help files
provided by BCB.

Regards.

"Steve" <sportock (AT) hotmail (DOT) com> wrote

Quote:

I want to place a button on my form.
I want the button to allow me to change
the dbgrid options to what I wish after the
form is running. How do I do that?



Back to top
Steve
Guest





PostPosted: Thu Oct 28, 2004 12:37 pm    Post subject: Re: How do you change dbGrid options at runtime Reply with quote


I would not be posting if I could find the answer in the help
or various books I have on borland products. Here is what I am doing, I set the grid to be non editable in the property sheet at design time. I load the same grid with different recordsets. Some I want to be able to edit at runtime, some not. I want to be able to change that after the grid loads, when I want to. I don't see why this should be so difficult, surely someone else has wanted to do this as well.

Thanks Steve


"Newsreader" <Newsreader (AT) newsgroup (DOT) com> wrote:
Quote:
As, you never spacify what you want to change, it's to broad to explain. I'd
suggest you read the full documentation of TDBGrid in the help files
provided by BCB.

Regards.

"Steve" <sportock (AT) hotmail (DOT) com> wrote in message
news:41807d7a$1 (AT) newsgroups (DOT) borland.com...

I want to place a button on my form.
I want the button to allow me to change
the dbgrid options to what I wish after the
form is running. How do I do that?




Back to top
PaoloItaly
Guest





PostPosted: Thu Oct 28, 2004 1:23 pm    Post subject: Re: How do you change dbGrid options at runtime Reply with quote

Quote:
I want the button to allow me to change
the dbgrid options to what I wish after the
form is running. How do I do that?

DBGrid1->Options ?



Back to top
Mark Jacobs
Guest





PostPosted: Thu Oct 28, 2004 1:23 pm    Post subject: Re: How do you change dbGrid options at runtime Reply with quote

We're a bit touchy (touched!?!) here in the BCB newsgroups - the best in the
world! So your flippant tone won't earn you any favours. However, I am in a
good mood today (though why is a complete mystery; I should be out
granny-bashing at the moment), so here is what I found in the BCB help file :-

TDBGrid has a property Options. One of these options controls the ability to
update records in the grid :-

dgEditing

true: (Default). Enables editing, inserting, and deleting records in the grid.
false: Disables editing, inserting, and deleting records in the grid.

So, disable editing by going

DBGrid1->Options=DBGrid1->Options>>dgEditing;

and enable it with


DBGrid1->Options=DBGrid1->Options<
HTH
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk

"Steve"
Quote:
I would not be posting if I could find the answer in the help
or various books I have on borland products. Here is what I am doing, I set
the grid to be non editable in the property sheet at design time.I
load the same grid with different recordsets. Some I want to be able to edit
at runtime, some not. I want to be able to change that after the
grid loads, when I want to. I don't see why this should be so difficult,
surely someone else has wanted to do this as well.




Back to top
Steve
Guest





PostPosted: Thu Oct 28, 2004 1:54 pm    Post subject: Re: How do you change dbGrid options at runtime Reply with quote


Mark,

Thanks very much, that is what I was looking for, I could not find this anywhere. The prev answer did po me as if I could
find it in the help I would not have posted. Any where
I could read up on to really learn how to manipulate the
dbGrid? I would like to be able to do more with it.

Steve

"Mark Jacobs" <http://www.jacobsm.com/mjmsg?Borland%20Newsgroup> wrote:
Quote:
We're a bit touchy (touched!?!) here in the BCB newsgroups - the best in the
world! So your flippant tone won't earn you any favours. However, I am in a
good mood today (though why is a complete mystery; I should be out
granny-bashing at the moment), so here is what I found in the BCB help file :-

TDBGrid has a property Options. One of these options controls the ability to
update records in the grid :-

dgEditing

true: (Default). Enables editing, inserting, and deleting records in the grid.
false: Disables editing, inserting, and deleting records in the grid.

So, disable editing by going

DBGrid1->Options=DBGrid1->Options>>dgEditing;

and enable it with


DBGrid1->Options=DBGrid1->Options<
HTH
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk

"Steve" news:4180e808$1 (AT) newsgroups (DOT) borland.com...
| I would not be posting if I could find the answer in the help
| or various books I have on borland products. Here is what I am doing, I set
the grid to be non editable in the property sheet at design time.I
| load the same grid with different recordsets. Some I want to be able to edit
at runtime, some not. I want to be able to change that after the
| grid loads, when I want to. I don't see why this should be so difficult,
surely someone else has wanted to do this as well.




Back to top
Newsreader
Guest





PostPosted: Fri Oct 29, 2004 3:44 am    Post subject: Re: How do you change dbGrid options at runtime Reply with quote

Well, to begin with, your first post never describe what you want to do,
it's hard for us to help you if we do not know what you are going to
attempt. That's why I suggest you to read the docs to find out more detail.

If you have stated you want to disable editing to the DBGrid in your first
post, surely I'd give you the answer. Well since I'm in a good mood (like
Mark Smile) and really want to help (that's why I'm reading the forum), I'll
throw in more details for you.

As you described in the 2nd letter, you want to enable editing in some
fields (Columns) of the DBGrid, while making others non-editable, here is
the answer:

DBGrid1->ReadOnly = false; //make sure the Grid is not ReadOnly
DBGrid1->Columns->Items[the index of fields you want to make
non-editable]->ReadOnly = true;

And no! you cannot reverse the logic by setting the DBGrid to ReadOnly and
set certain fields to ReadOnly = false. This won't work

Remember, always be more descriptive and ask the question in a precise way.
It's the first few rules of this newsgroup.

Regards.

"Steve " <sportock (AT) hotmail (DOT) com> wrote

Quote:

Mark,

Thanks very much, that is what I was looking for, I could not find this
anywhere. The prev answer did po me as if I could
find it in the help I would not have posted. Any where
I could read up on to really learn how to manipulate the
dbGrid? I would like to be able to do more with it.






Back to top
Mark Jacobs
Guest





PostPosted: Fri Oct 29, 2004 11:05 am    Post subject: Re: How do you change dbGrid options at runtime Reply with quote

A good link for DBGrid stuff is http://delphi.about.com/b/a/027886.htm (Zarko
Gajic's site), but it is in Delphi. However, the function, event and property
names are usually the same as in BCB, so it should give you some pointers on
how to get the most out of DBGrid. Good luck,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk

"Steve " <sportock (AT) hotmail (DOT) com> wrote

Quote:
Thanks very much, that is what I was looking for, I could not find this
anywhere. The prev answer did po me as if I could
find it in the help I would not have posted. Any where
I could read up on to really learn how to manipulate the
dbGrid? I would like to be able to do more with it.



Back to top
Lynn Morrison
Guest





PostPosted: Sat Oct 30, 2004 1:34 pm    Post subject: Re: How do you change dbGrid options at runtime Reply with quote

Quote:
I would not be posting if I could find the answer in the help
or various books I have on borland products. Here is what I am doing, I
set the grid to be non editable in the property sheet at design time. I load

the same grid with different recordsets. Some I want to be able to edit at
runtime, some not. I want to be able to change that after the grid loads,
when I want to. I don't see why this should be so difficult, surely someone
else has wanted to do this as well.
Quote:


Options is a set. If you look for help on Sets, you will how to use the
Quote:
and << operators to change set items...

Lynn



Back to top
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
 


Powered by phpBB © 2001, 2006 phpBB Group
.