newbie: change the datawindow style at runtime?

I want to allow the user to click a button and change the datawindow style.
So, if data window is showing as freeform, then the user clicks the button
and the datawindow changes to grid style. This would allow the user to see
more than one record at a time using the grid style and edit a single record
using the freeform style. How can i do this?


--

Thanks,

Stephane Viau
Ottawa, Canada


0
Stephane
3/24/1999 4:38:30 PM
sybase.powerbuilder.general 62418 articles. 18 followers. Follow

3 Replies
530 Views

Similar Articles

[PageSpeed] 47

A possible solution is to build all the datawindow objects you need and then
change the DataObject proporty for the datawindow control to whatever datawindow
you want, for example:

Clicked event of cb_1:
dw_1.DataObject = 'd_customers_grid'
dw_1.SetTransObject(SQLCA)
dw_1.Retrieve()

Hope this helps.

Stephane Viau wrote:

> I want to allow the user to click a button and change the datawindow style.
> So, if data window is showing as freeform, then the user clicks the button
> and the datawindow changes to grid style. This would allow the user to see
> more than one record at a time using the grid style and edit a single record
> using the freeform style. How can i do this?
>
> --
>
> Thanks,
>
> Stephane Viau
> Ottawa, Canada

--
Braulio Rojas Alarc�n
Ingeniero de Soporte T�cnico
Grupo SOIN, S.A. de C.V.
Tel: 282 8097   Fax: 282 8035


0
Braulio
3/24/1999 10:50:29 AM
Hi Stephane!

Officially you can't do that. There are some undocumented techniques
that export the syntax of a datawindow, change it, and import it again.
But I wouldn't do that.
A much better solution is to use datawindow sharing (ShareData). With
this technique, you create datawinodws with different styles that
share the same data.

Volker


0
Volker
3/24/1999 4:53:55 PM
Method 1: STATIC - customised for each datawindow; FAST
Create the dw in different styles and place them all in your window and share
the data between them,
hiding all but the own you want to see (or place them on different tab pages in
a tab object). Then just
make visible the one you want to see and hide all the others.

Method 2 - DYNAMIC - for any datawindow without knowing its contents: SLOW -
requires re-retrieving each dw
Get the datawindow syntax. MODIFY style to the style you require and then CREATE
the datawindow control again and then Re-Retrieve.

BEST: Method 3: - MIXED - FAST but a little complicated - but generic
I use this method intensively to display the same data as a GRID, FREEFORM,
LABELS and GRAPHS

Create EMPTY dws controls for each of the styles you intend to use, but ONLY
LINK ONE to a dw dataobject
(or create it on the fly from some SQL).
Hide the dw objects you don't intend to use right now, showing only the current
view.
Get the syntax for the dw and modify for the other styles.
Create the alternate dw controls from the SYNTAX
Retrieve and Share data.

Stephane Viau wrote:

> I want to allow the user to click a button and change the datawindow style.
> So, if data window is showing as freeform, then the user clicks the button
> and the datawindow changes to grid style. This would allow the user to see
> more than one record at a time using the grid style and edit a single record
> using the freeform style. How can i do this?
>
> --
>
> Thanks,
>
> Stephane Viau
> Ottawa, Canada



0
avron
3/25/1999 8:07:16 AM
Reply: