PDA

View Full Version : Refresh supercontrol (report preview)


ABC123

NoeticCC
03-27-2008, 08:31 AM
Sorry if this is explained somewhere (I can't find it) but what is the syntax for refreshing a report preview supercontrol from a script or from event code on a form?

Thanks

Phil Rolf
03-27-2008, 08:54 AM
Andrea, I am glad you brought this up. I tried placing the clock on a form to show the current time. However, when I went to Action Scripting for the Ontimer event, V9 did not recognize the Super control clock as an object in order to refresh the clock object. So I would like to know if the clock can be refreshed on a form?

DaveM
03-27-2008, 09:35 AM
Did you try the ontimer event for the form. Not that i know if it will work, but a thought.

Phil Rolf
03-27-2008, 09:48 AM
I went to the form events then
1. Form Ontimer
2. action scripting
3. object properties
4. Refresh objects - however if you try to ADD an object to the list of objects to be refreshed, the supercontrol is NOT listed and you cannot manually input an object.

I do NOT want to refresh the entire form as it would update queries (if on) and I do not want that.

NoeticCC
03-27-2008, 10:14 AM
I went to the form events then
1. Form Ontimer
2. action scripting
3. object properties
4. Refresh objects - however if you try to ADD an object to the list of objects to be refreshed, the supercontrol is NOT listed and you cannot manually input an object.

I do NOT want to refresh the entire form as it would update queries (if on) and I do not want that.

Same here, the supercontrol is listed in the Xbasic Explorer but I haven't a clue what to do with this. YES I do want to refresh the form but only if an email whose data was added to the tables on these two reports has been updated...

Selwyn Rabins
03-27-2008, 11:12 AM
Andrea, I am glad you brought this up. I tried placing the clock on a form to show the current time. However, when I went to Action Scripting for the Ontimer event, V9 did not recognize the Super control clock as an object in order to refresh the clock object. So I would like to know if the clock can be refreshed on a form?


the clock supercontrol is designed to show the value of a field in the table that the form is based on. in other words, instead of showing the value of some time field in an edit box, it shows the value in a clock.

the clock supercontrol is not a "free standing" clock that shows the current time.

because the clock is "bound" to a field in the current table, it does not need to be refreshed. it always automatically shows the value in field to which it is bound.

in effect, the clock is just another type of 'input control' for a time field on the form.

if you wanted the clock to show the current time, you would have to do this:
1. create a time variable on the form.
2. place a supercontrol clock on the form, and bind it to this variable.
3. in the form's onTimer event, set the value of this time variable.

the clock will then automatically display the value in the time variable.

Selwyn Rabins
03-27-2008, 11:15 AM
Sorry if this is explained somewhere (I can't find it) but what is the syntax for refreshing a report preview supercontrol from a script or from event code on a form?

Thanks

Not sure what you mean by 'refresh' a report preview control.

The report preview is automatically refreshed when you navigate to a new record, or whenever a field or variable in the report preview control's "linking expression" changes.

you never have to "manually" refresh the control. it is all automatic.

if you can point us to some instance where the report preview should have refreshed, but did not, point it out to us, and we will fix it.

Bill Griffin
03-27-2008, 11:21 AM
in effect, the clock is just another type of 'input control' for a time field on the form.

if you wanted the clock to show the current time, you would have to do this:
1. create a time variable on the form.
2. place a supercontrol clock on the form, and bind it to this variable.
3. in the form's onTimer event, set the value of this time variable.

the clock will then automatically display the value in the time variable.

Selwyn,

The focus also has to remain on the field for the clock to update in realtime (or so it seems). Is this correct?

Bill

Selwyn Rabins
03-27-2008, 11:24 AM
Selwyn,

The focus also has to remain on the field for the clock to update in realtime (or so it seems). Is this correct?

Bill

no, i don't think that would or should be necessary.

alpha five automatically puts a "watch" on any variable that a clock supercontrol is bound to and then when that variable's value changes, the clock will automatically update.

Bill Griffin
03-27-2008, 11:28 AM
Selwyn,

I just tried this and it does seem that the field need to have focus for the clock to refresh.

Bill

NoeticCC
03-27-2008, 12:07 PM
Not sure what you mean by 'refresh' a report preview control.

The report preview is automatically refreshed when you navigate to a new record, or whenever a field or variable in the report preview control's "linking expression" changes.

Ah that's it, basically I am using a form to display entries from two tables that get populated every few minutes with data from processing incoming emails to a specific Email address. Because the report doesn't need any retrieval arguments, it worked without my specifying the linking fields, but once I specified those it started refreshing whenever a new Email is processed. Thanks!

I guess I am just using this in lieu of a browse, as a read only display only "status report" of a list of recently handled Emails... The problem with using a browse is I want a snapshot and I do not want it to update constantly but rather only after new incoming emails have been handled. Plus, the scroll behaviour on the browse makes this a bit awkward too if I use browses instead. (And this is handy because the toolbar for the report preview allows you to save/email the current report straight away)

Selwyn Rabins
03-27-2008, 01:24 PM
Selwyn,

I just tried this and it does seem that the field need to have focus for the clock to refresh.

Bill


I just tested it and it does work. You do need to call the clock object .refresh() method.

Here is how I did it.

1. I defined a session variable call 'time1. (it could have been a form variable or a global - does not matter what scope you choose)
to define the variable, I clicked the "V" button on the toolbar and typed
time1 = now()

2. I put a clock supercontrol on the form and bound it to 'var->time1' . I noted that the clock object name was "clock1"

3. in the form's OnTimer event i put:

dim shared time1 as t
time1 = now()
clock1.refresh()


This works fine.

Lance Gurd
03-27-2008, 02:11 PM
Why dont you put a dock panel associated with the forms, then the user can turn it off if required here is mine. Which was formed using the following code:

function dockPanel_5 as v (vars as p )
with vars
'Notice that the code in this function is wrapped in a 'with vars...end with' statement.
'Local_variables() are passed in when the function is called.
'Because of the 'with vars' statement, this code is executing in the same variable frame as the Xdialog so it can
'see all of the variables in the Xdialog.
DIM SHARED cl as T
DIM cl_Clock as P
cl=time("",now())
DIM cl_Clock.events as C = <<%str%
function onTimeSelect as v (ptr as p)

' Generated code. Do not delete!
' ------------------------------------------------------------------------
if eval_valid("ptr.variableName") then
dim sv as p
sv = session_variables()
evaluate_template("sv."+ptr.variableName+" = if(typeof(sv."+ptr.variableName+")=\"T\",ptr.time,ptr.shortTime)")
end if
' ------------------------------------------------------------------------
end function
function onMeridianChange as v (ptr as p)

end function
%str%
if typeof(cl) = "Y" then
DIM cl_Clock.shortTime as Y = cl
else
DIM cl_Clock.time as T = cl
end if
DIM cl_Clock.variableName as C = "cl"
dim dlg_panel_body as c
dlg_panel_body = <<%dlg%
{background=Pale Blue}
{timer=increment}
{interval=1}
{stretch=height,width}
{TimePicker=40,15cl_Clock}{watch=cl!update_cl_Clock};
{stretch=}
{stickto=bottom,left}
%dlg%
dim dlg_panel_event as c
dlg_panel_event = <<%code%
if a_dlg_button = "increment" then
cl_Clock.shortTime=time("",now())


end if

Bill Griffin
03-27-2008, 02:15 PM
I just tested it and it does work. You do need to call the clock object .refresh() method.

Here is how I did it.

1. I defined a session variable call 'time1. (it could have been a form variable or a global - does not matter what scope you choose)
to define the variable, I clicked the "V" button on the toolbar and typed
time1 = now()

2. I put a clock supercontrol on the form and bound it to 'var->time1' . I noted that the clock object name was "clock1"

3. in the form's OnTimer event i put:

dim shared time1 as t
time1 = now()
clock1.refresh()


This works fine.

Ah Ha!! missing the clock1.refresh()

Thanks

NoeticCC
03-27-2008, 02:57 PM
Ah Ha!! missing the clock1.refresh()

Thanks

Yep, that's sort of what I was looking for too, just the basic syntax... Normally I just try it out, don't know why I didn't bother this time!

NoeticCC
03-27-2008, 02:59 PM
Why dont you put a dock panel associated with the forms,

Thanks for the reminder, been meaning to check those out!

Phil Rolf
03-27-2008, 05:23 PM
Thanks, the clock is keeping time.....