Code the following user-defined function, called ZOOM.

function Zoom(void)
declare function Get_Property, Dialog_Box
declare subroutine Set_Property
$insert Logical
 
*Get the control that has focus and it's control TYPE
Ctrl = Get_Property(@window, "FOCUS")
Type = Get_Property(Ctrl, "TYPE")
 
/* If the control is an edit table, get its position;
if the control TYPE begins with "EDIT", set the variable Aux to null
*/
begin case
  case Type = "EDITTABLE"
    Aux = Get_Property(Ctrl, "SELPOS")
  case Type [1,4] = "EDIT"
    Aux = Get_Property(Ctrl,'DEFPROP')
  case OTHERWISE$
    return
end case
 
/* This code assigns the window's control name or the MDIFRAME's
control name to a variable. */
Parent = @window
Frame = Get_Property(Parent, "MDIFRAME")
if len(Frame) then
   Parent = Frame
end
 
/* Get the default property "DEFPROP" for the control with focus; this
is probably text displayed in the control; then
Display the ZOOM window as a dialog box and pass in to the ZOOM
window's CREATE event the "text" (DEFPROP) from the control with
focus. */
Orig = Get_Property(Ctrl, "DEFPROP", Aux)
Text = Dialog_Box("ZOOM", Parent, Orig)
/* If the variable Text is not null and not equal to Orig, then the
text (DEFPROP) is updated for the control with focus. */
if len(Text) and Text # Orig then
  Set_Property(Ctrl, "DEFPROP", Text, Aux)
end
return Text
  • No labels