Index
2000-08-29 17:31A Hilton : Grid = Container Class behavior
2000-08-30 12:49GOPAL : Re: Grid = Container Class behavior
2000-08-30 17:59Abergquis@cs.com: Re: Grid = Container Class behavior
2000-08-31 10:17Abergquis@cs.com: Re: Grid = Container Class behavior
2000-09-01 09:52A Hilton : RE: Grid = Container Class behavior
2000-09-01 10:10Paul McNett : RE: Grid = Container Class behavior
2000-09-09 09:01Buckhorn Ranch : RE: Grid = Container Class behavior
2000-09-09 18:21A Hilton : RE: Grid = Container Class behavior
2000-09-17 07:03Buckhorn Ranch : RE: Grid = Container Class behavior
2000-09-17 18:40A Hilton : RE: Grid = Container Class behavior
Back to top
Grid = Container Class behavior

Author: A Hilton

Posted: 2000-08-29 17:31:54   Link

Does anybody have some ideas on this?

I have a grid (my old nemesis!) showing records from a table in a database.

I've made a class based on the container baseclass that I add to the grids'

1 and only column. The container class has several lables, textboxes,

comboboxes, etc. This allows me to show multiple fields for each record in

the table without the user having to scroll horizontally. This all works

and is fine (with very frustrating limitations I've found in the past).

I'm wanting to have one label on the container class turn to a red forecolor

when a field in the record is empty. I've tried doing this many ways but

they all boil down to refreshing the grid which refreshes the container

class which does something like...

if empty(field)

this.label1.forecolor = red

else

this.label1.forecolor = black

endif

Here's the problem: The label is only turning red when the focus is on the

particular record that has an empty field (instead of doing it when the

focus is on some other record that doesn't have the empty field in the

record) AND *all* records' (3 or 4 records show at once on the form)

container class labels turn red (not just the record that has the empty

field).

I want the label to turn red whether or not the focus is on that

empty-fielded record AND for ONLY that label to turn red instead of ALL the

labels turning red for each record.

I've tried using the grids' setall method for Dynamicforecolor/backcolor to

get a highlighted row as well but the container class covers up the entire

row and won't show.

So, did I explain the situation well enough and does anybody have a clue

what I should try next?

- A Hilton

©2000 A Hilton
Back to top
Re: Grid = Container Class behavior

Author: GOPAL

Posted: 2000-08-30 12:49:51   Link

Hi Hilton

I also have the same problem, I am using container in grid since long time

but I also tried so many ways, no result. You cannot change the property

based on the control. becasue the control object may be display more than

one time according to the no of rows but the object property is one.

If you say forecolor=xxx that applies for the whole column. There is no

dynamic property except grid columns.

Gopal

( I may be wrong, let's see if anybody gives a solution)

----- Original Message -----

From: A Hilton <ahilton@usexpr.com>

To: Multiple recipients of ProFox <profox@leafe.com>

Sent: Tuesday, August 29, 2000 6:31 PM

Subject: Grid = Container Class behavior

> Does anybody have some ideas on this?

>

> I have a grid (my old nemesis!) showing records from a table in a

database.

> I've made a class based on the container baseclass that I add to the

grids'

> 1 and only column. The container class has several lables, textboxes,

> comboboxes, etc. This allows me to show multiple fields for each record in

> the table without the user having to scroll horizontally. This all works

> and is fine (with very frustrating limitations I've found in the past).

>

> I'm wanting to have one label on the container class turn to a red

forecolor

> when a field in the record is empty. I've tried doing this many ways but

> they all boil down to refreshing the grid which refreshes the container

> class which does something like...

>

> if empty(field)

> this.label1.forecolor = red

> else

> this.label1.forecolor = black

> endif

>

> Here's the problem: The label is only turning red when the focus is on the

> particular record that has an empty field (instead of doing it when the

> focus is on some other record that doesn't have the empty field in the

> record) AND *all* records' (3 or 4 records show at once on the form)

> container class labels turn red (not just the record that has the empty

> field).

>

> I want the label to turn red whether or not the focus is on that

> empty-fielded record AND for ONLY that label to turn red instead of ALL

the

> labels turning red for each record.

>

> I've tried using the grids' setall method for Dynamicforecolor/backcolor

to

> get a highlighted row as well but the container class covers up the entire

> row and won't show.

>

> So, did I explain the situation well enough and does anybody have a clue

> what I should try next?

>

> - A Hilton

>

>

>

> ----------------------------------------

> Subscription maintenance at:

> http://leafe.com/mailListMaint.html

>

>

>

©2000 GOPAL
Back to top
Re: Grid = Container Class behavior

Author: Abergquis@cs.com

Posted: 2000-08-30 17:59:41   Link

Have you tried setting the column's Sparse property to .F.?

HTH,

Art Bergquist

abergquis@cs.com

In a message dated 8/30/2000 1:09:50 AM Pacific Daylight Time,

ahilton@usexpr.com writes:

> Does anybody have some ideas on this?

>

> I have a grid (my old nemesis!) showing records from a table in a database.

> I've made a class based on the container baseclass that I add to the grids'

> 1 and only column. The container class has several lables, textboxes,

> comboboxes, etc. This allows me to show multiple fields for each record in

> the table without the user having to scroll horizontally. This all works

> and is fine (with very frustrating limitations I've found in the past).

>

> I'm wanting to have one label on the container class turn to a red

forecolor

> when a field in the record is empty. I've tried doing this many ways but

> they all boil down to refreshing the grid which refreshes the container

> class which does something like...

>

> if empty(field)

> this.label1.forecolor = red

> else

> this.label1.forecolor = black

> endif

>

> Here's the problem: The label is only turning red when the focus is on the

> particular record that has an empty field (instead of doing it when the

> focus is on some other record that doesn't have the empty field in the

> record) AND *all* records' (3 or 4 records show at once on the form)

> container class labels turn red (not just the record that has the empty

> field).

>

> I want the label to turn red whether or not the focus is on that

> empty-fielded record AND for ONLY that label to turn red instead of ALL the

> labels turning red for each record.

>

> I've tried using the grids' setall method for Dynamicforecolor/backcolor to

> get a highlighted row as well but the container class covers up the entire

> row and won't show.

>

> So, did I explain the situation well enough and does anybody have a clue

> what I should try next?

>

> - A Hilton

>

©2000 Abergquis@cs.com
Back to top
Re: Grid = Container Class behavior

Author: Abergquis@cs.com

Posted: 2000-08-31 10:17:44   Link

Not so quick; check out my "DynamicCurrentControlSource" article in FoxPro

Advisor / February 2000 issue. The gist is to have two (2) separate controls

in your column, the only difference being the red label in one of them. Set

the column's Bound property to .F. and ResetToDefault() the column's

ControlSource (so that's it not set). Then set the ControlSource for each

control (i.e., the two [2] instances of your container] within the column.

Finally, at the end of your grid's Init() event/method, set Column1's

DynamicCurrentControl property by calling a custom "DynamicCurrentControl()"

method in which you place your If logic (alternatively, you can employ Do

Case logic if/when you have more than 2 cases) to determine which control to

display when.

(BTW, you can also set the DynamicCurrentControl property with an IIf

statement but I find it a *ton* easier to debug If and Do Case constructs in

a method than IIf methods *especially* when you have more than 2 cases.)

HTH,

Art Bergquist

abergquis@cs.com

In a message dated 8/30/2000 7:54:16 PM Pacific Daylight Time,

ahilton@usexpr.com writes:

> Yes, it's set to .F. That's the only way to get the container object to

> display at all in the column of the grid.

>

> The grid and container object therein have been working for almost 3 yrs

now

> (with other unrelated difficulties that I've had to work around) and I'm

> just trying to add this little user notification to one of the rows.

Thanks

> for the thought though.

>

> I believe Gopal explained it best. There really is just one object

reference

> and it is simply replicated over again for each row. There's no way to

> separate each container object based on row in the grid. I'll just have to

> notify the user in some other way outside of the grid.

>

> - A Hilton

>

> Here's the problem: The label is only turning red when the focus is on the

> particular record that has an empty field (instead of doing it when the

> focus is on some other record that doesn't have the empty field in the

> record) AND *all* records' (3 or 4 records show at once on the form)

> container class labels turn red (not just the record that has the empty

> field).

>

> I want the label to turn red whether or not the focus is on that

> empty-fielded record AND for ONLY that label to turn red instead of ALL the

> labels turning red for each record.

>

©2000 Abergquis@cs.com
Back to top
RE: Grid = Container Class behavior

Author: A Hilton

Posted: 2000-09-01 09:52:29   Link

Thanks. Neat idea but it didn't work.

Never could get the dynamiccurrentcontrol (there is no

dynamiccurrentcontrolsource) to work at all. I tried both calling a

procedure and an iif() function but neither worked. I even tried a very

simple test of a default grid baseclass with just a test free table and

putting another textbox in a column (giving 2 textboxes total) and trying a

dynamiccurrentcontrol on that but it didn't work either. It either gave me

the textbox1 or nothing at all. I'm sure it's something I'm just not setting

correctly. I even tried some grids' setall() methods (I've done that

extensively with dynamicbackgroundcolor,etc. and it's worked well for me

with multiple columns) to see if I could go around that way but, still, no

luck.

As a side note, having another container class and using the

dynamiccurrentcontrol (which didn't show any difference as stated above)

slowed that form down around 15-20% on browsing/navigating the records and

that wouldn't have worked anyway even if it had worked as I wanted. Another

problem I had was removing the second object in the column. It simply would

not be removed/destroyed. I could remove the first (original) container

class by simply doing something like:

thisform.grid.column.removeobject("mycontainer1")

but never could get the second container object removed by any means.

Strange. I'll have to play with that some other time though.

Thanks again for the idea.

- A Hilton

> Not so quick; check out my "DynamicCurrentControlSource" article

> in FoxPro

> Advisor / February 2000 issue. The gist is to have two (2)

> separate controls

> in your column, the only difference being the red label in one of

> them. Set

> the column's Bound property to .F. and ResetToDefault() the column's

> ControlSource (so that's it not set). Then set the ControlSource

> for each

> control (i.e., the two [2] instances of your container] within

> the column.

> Finally, at the end of your grid's Init() event/method, set Column1's

> DynamicCurrentControl property by calling a custom

> "DynamicCurrentControl()"

> method in which you place your If logic (alternatively, you can employ Do

> Case logic if/when you have more than 2 cases) to determine which

> control to

> display when.

>

> (BTW, you can also set the DynamicCurrentControl property with an IIf

> statement but I find it a *ton* easier to debug If and Do Case

> constructs in

> a method than IIf methods *especially* when you have more than 2 cases.)

>

> HTH,

>

> Art Bergquist

> abergquis@cs.com

>

©2000 A Hilton
Back to top
RE: Grid = Container Class behavior

Author: Paul McNett

Posted: 2000-09-01 10:10:05   Link

A,

> Never could get the dynamiccurrentcontrol (there is no

> dynamiccurrentcontrolsource) to work at all.

You don't need a dynamiccurrentcontrolsource. Just set each control up

with their own controlsources, and then work off of dynamiccurrentcontrol.

Or maybe I skimmed too fast...

Paul McNett Software Consulting

Hollister, CA USA

©2000 Paul McNett
Back to top
RE: Grid = Container Class behavior

Author: Buckhorn Ranch

Posted: 2000-09-09 09:01:30   Link

>>>I'll have to give the DynamicCurrentControl option another look down

the road with some other things.

You would simply have to create two containers, one with a red label and one

with a black label and switch them using the DynamicCurrentControl property.

pamela

©2000 Buckhorn Ranch
Back to top
RE: Grid = Container Class behavior

Author: A Hilton

Posted: 2000-09-09 18:21:05   Link

I gave it a couple of hours trying to get DynamicCurrentControl to work and

it never did. I couldn't even get DynamicCurrentControl working with a

simple test table I made and a blank form with just 2 plain textboxes in a

column. I thought it should work and it was a good idea but the

implementation just didn't work out. Like I said, I'll have to go back to

it on something else in the future.

Thanks,

- A Hilton

>

> >>>I'll have to give the DynamicCurrentControl option another look down

> the road with some other things.

>

> You would simply have to create two containers, one with a red

> label and one

> with a black label and switch them using the

> DynamicCurrentControl property.

>

> pamela

>

©2000 A Hilton
Back to top
RE: Grid = Container Class behavior

Author: Buckhorn Ranch

Posted: 2000-09-17 07:03:28   Link

Hi,

Sorry I don't have time to get back here often enough to be useful. The

tough part with the DynamicCurrentControl is getting the expression right.

It isn't always necessary, but I have had luck with putting the expression

in quotation marks and putting an equals sign in front of it. It took me

forever to get my first dynamic property into production, but they are the

only way to achieve certain effects in a grid. If you want to post the

specifics of what you tried, I'll try to check this week and see if I can

assist further.

pamela

©2000 Buckhorn Ranch
Back to top
RE: Grid = Container Class behavior

Author: A Hilton

Posted: 2000-09-17 18:40:06   Link

I tried it both with and without quotes. I've used

DynamicBackColor/ForeColor extensively and like using those but I just never

could get DynamicCurrentControl to work. I've since ripped out that test

code and moved on so I don't have any code to post. But thanks for the help

anyway.

- A Hilton

> Hi,

>

> Sorry I don't have time to get back here often enough to be useful. The

> tough part with the DynamicCurrentControl is getting the expression right.

> It isn't always necessary, but I have had luck with putting the expression

> in quotation marks and putting an equals sign in front of it. It took me

> forever to get my first dynamic property into production, but they are the

> only way to achieve certain effects in a grid. If you want to post the

> specifics of what you tried, I'll try to check this week and see if I can

> assist further.

>

> pamela

©2000 A Hilton