From: swas on
Hello,

Is it possible to create a class that is bound to a field?

Any links / help along these lines is appreciated.


Thanks


swas
From: Banana on
swas wrote:
> Hello,
>
> Is it possible to create a class that is bound to a field?
>
> Any links / help along these lines is appreciated.
>
>
> Thanks
>
>
> swas

But what is meant by 'bound to a field'? What is the class's ultimate
purpose?

If by 'bound class', you're hoping you can get the class in the property
list and select a field for its "Control Source", then the answer is no.
But if you do it in VBA... sure. But it'll depend more on what you want
to do with it for us to give the best advice.
From: Jack Leach dymondjack at hot mail dot on
What do you intend to do with this? A control (not a field) is bound to a
Field in a table of data... classes are not tables of data, they are code.
Fields aren't "bound" to anything except the TableDef.

Are you looking to have a control on a form that uses some data in Class?
This is possible... one way or another, a Class will crunch data of some
sort, but you will still need a way to get that data to the Class (be it an
external pass to the class or as a function of the class to get the data).
But there's no reason you cannot set up a control and use the events of that
controls to interact with a class that will do something to the data.

A little (or a lot) more info...

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



"swas" wrote:

> Hello,
>
> Is it possible to create a class that is bound to a field?
>
> Any links / help along these lines is appreciated.
>
>
> Thanks
>
>
> swas
From: swas on
Thanks for the quick responses.

I have two situations.

1) The comctrl slider control and

2) My own generated slider control (Using mouse down / move events) to
emulate a slider control but without having to reference the comctrl lib.

Either works fine, but I want to display the slider in a continuous form
view, so the slider shows the bound setting to its controlsource field.

In other words, as you look down a page of continous controls, you see the
visual position of the slider, and changing one is reflected in the table.

Hopefully I have made sense here...

Thanks again.


swas
From: Jack Leach dymondjack at hot mail dot on
I'm assuming that your class will return some sort of value for the current
position of the slider. I think the way I would approach this would be to
use the form's BeforeUpdate event to capture the current value of the slider
and (after doing any conversion you might need to turn this into a usuable
value), apply the value to the field in the recordsource of the form.

So, if I have that correct, you do not actually need a control for what you
want to store... the slider will be unbound, and you will "manually" bind it
before the record is saved.

hopefully I'm on track here...
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



"swas" wrote:

> Thanks for the quick responses.
>
> I have two situations.
>
> 1) The comctrl slider control and
>
> 2) My own generated slider control (Using mouse down / move events) to
> emulate a slider control but without having to reference the comctrl lib.
>
> Either works fine, but I want to display the slider in a continuous form
> view, so the slider shows the bound setting to its controlsource field.
>
> In other words, as you look down a page of continous controls, you see the
> visual position of the slider, and changing one is reflected in the table.
>
> Hopefully I have made sense here...
>
> Thanks again.
>
>
> swas