Freeze that control

Clarion 7.1 introduces two new functions; FREEZE and UNFREEZE.  FREEZE/UNFREEZE are used in tandem to suppress redrawing while you adjust multiple attributes of a control. For example, you would typically call the FREEZE method, then set the Size, Location, Text, or Color properties of the control, and then call the  UNFREEZE method to enable the changes to take effect.  This can increase the performance of applications with many controls, and eliminate screen flicker when dynamically creating controls or adjusting their properties.

The syntax is:

FREEZE (SIGNED feq),SIGNED

FREEZE suspends redrawing of the control which is identified by the feq parameter.
The return value must be passed to a paired UNFREEZE.

UNFREEZE (SIGNED feq, SIGNED state)

This function resumes redrawing of the control previously suspended by FREEZE.
The second parameter is a value returned by last FREEZE for that control which has not been closed
by paired UNFREEZE.

Calls to FREEZE can be nested. Every such call must have its paired UNFREEZE,
for example:

x1# = FREEZE (feq)
...
x2# = FREEZE (feq)
...
UNFREEZE (feq, x2#)
...
UNFREEZE (feq, x1#)

FREEZE and UNFREEZE must be properly paired: if there isn’t a paired call to UNFREEZE for an executed FREEZE, the control cannot be redrawn. The UNFREEZE function forces redrawing of the control.

(note: FREEZE/UNFREEZE cannot be used for menu items)

4 thoughts on “Freeze that control

  1. I think there is no need to make it more complicated using queues.

    1. Can you give me an example why you would need to nest a frozen control?

    2. Can you not just have an option to freeze all controls on a WINDOW, do what you need to, then unfreeze the WINDOW?

    3. What’s the difference between LAZYDISPLAY and FREEZE? Wouldn’t LAZYDISPLAY do the same thing?

  2. There has been discussion on the Clarion7 usergroup as to exactly how this would work with a large number of controls on a window – and the resultant need to many variables to keep track of the controls state.
    (Freeze Controls – Robert Paresi 24/08/2009)

    I think what’s needed is some sort of FreezeManager extension that can be
    added to a window or a report.

    FreezeManager CLASS,TYPE
    Control_Q queue,private
    FEQ long
    state long
    end
    Init procedure()
    Refresh procedure()
    ice procedure(long singlecontrol)
    ice procedure(long startcontrol, long endcontrol)
    thaw procedure(long singlecontrol)
    thaw procedure(long startcontrol, long endcontrol)
    END

    Internally there would be a private queue of control equates and states,
    together with Init and Refresh methods.

    Init would build the queue by looping through the controls and adding an
    entry for each ‘freezable’ control.

    Refresh would update this queue (so that any destroyed / created controls
    could be catered for)

    You’d also have overloaded ICE and THAW procedures to freeze / unfreeze a
    single or a range of controls based on the passed in FEQs

    I can just about see the point of being able to freeze an already frozen
    control and the nesting.
    A third party template may need to freeze a range of controls whilst it does
    it’s thing without having to know the current state of the control or
    whether another template is also freezing.
    The class above would need modification to cope with this.

    It would undoubtably be preferable for SV to put this in place themselves
    and make the functionality available to endusers/template designers etc

    Graham

Comments are closed.