0
votes

I had a screen named w_main and i have 5 data windows

dw_one , dw_two , dw_three, dw_four ,dw_five

and here iam used the data windows in the screen with a user object uo_main,

i inserted a datawindow control to the uo_main , and in the open event i queried
Timer(5)

and in the timer event i queried as

uo_main.dw_1.dataobject = 'dw_one'
dw_1.insertrow(0);


uo_main.dw_1.dataobject = 'dw_two'
dw_1.insertrow(0);


uo_main.dw_1.dataobject = 'dw_three'
dw_1.insertrow(0);


uo_main.dw_1.dataobject = 'dw_four'
dw_1.insertrow(0);


uo_main.dw_1.dataobject = 'dw_five'
dw_1.insertrow(0);

this is to change the dataobject in the datawindow in every 5 seconds but its not working, how i make it possible,

its a updates displaying screen like project but i have to work it with powerbuilder.

1
I do not get the need for changing DataObject every 5 seconds, but every time You change it its content resets, You need to store it some where (like in a database) and Retrieve it every time You change it. Just have 5 DataWindow objects and make 'em visible one at at time every 5 sec. or something.Valdas
I think your code works (ie does not crash nor complains) but does not perform anything interesting, as Valdas explains. What do you want to achieve more precisely? What would you consider a success?Marc Vanhoomissen
It looks like you probably need an array of dataobject names or a switch statement for dataobjects, along with an instance variable to keep track of which DO you have active so that when the timer event runs, you only change the dataobject once instead of 5 times; If you run this code as is, you will only ever really see dw_five because the others will display and get changed immediately to the next one.Kateract

1 Answers

0
votes

Create five datawindow controls in your object, called dw_1 up to dw_5, and connect them respectively to the various datawindow objects dw_one up to dw_five (in design mode - you do not have to code everything). In such a case, your code would be:

dw_1.insertrow(0);
dw_2.insertrow(0);
dw_3.insertrow(0);
dw_4.insertrow(0);
dw_5.insertrow(0);

and every 5 seconds, you would see one more record in all those controls. Do not forget to connect the dw_1 to dw_5 to a database if DB interaction is needed (dw_1.settransObject(SQLCA) for instance).