Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    16

    Unanswered: another question about forms in pdox 7

    does anyone know if it is possible to a) keep a form from being "resize" by a user, e.g., if they drag on the corner, they are unable to resize the item, or b) allow a form to be resized in the windows sense, e.g., dragging corner will actually resize form and not just resize window with form on a white background?
    many thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    Bologna - Italy
    Posts
    209
    Sure:

    a) You cannot keep the user from resizing the form, but you can make the form return automatically to the max size it should be by means of this simple code:

    method menuAction(var eventInfo MenuEvent)
    var
    it smallint
    endvar
    it=eventinfo.id()
    switch
    case it = MenuControlRestore:
    autosize()
    case it = MenuControlSize:
    autosize()
    endswitch
    endmethod

    method autosize()
    var
    x,y,w,h longint
    scroll longint
    border longint
    title longint
    wconst longint
    hconst longint
    endvar

    scroll=longint(getRegistryValue ("Control Panel\\Desktop\\WindowMetrics","ScrollWidth",RegKe yCurrentUser))
    scroll=-(scroll) ;/TwipsPerPixel)

    border=longint(getRegistryValue ("Control Panel\\Desktop\\WindowMetrics","BorderWidth",RegKe yCurrentUser))
    border=-(border) ;/TwipsPerPixel)

    title=longint(getRegistryValue ("Control Panel\\Desktop\\WindowMetrics","CaptionHeight",Reg KeyCurrentUser))
    title=-(title) ;/TwipsPerPixel)

    wconst=(9*TwipsPerPixel) ;7 con riga, 6 senza
    hconst=(10*TwipsPerPixel) ;8 con riga, 7 senza

    delayscreenupdates(yes)
    self.getposition(x,y,w,h)
    tmppt1=self.size
    tmppt2=self.nameofabutton.container.size

    switch

    ;Out in the low right angle
    case tmppt1.x() > tmppt2.x() and tmppt1.y() > tmppt2.y():
    w=tmppt2.x() + (border*2) + wconst
    h=tmppt2.y() + (border*2) + title + hconst
    self.setposition(x,y,w,h)

    ;out horizontally
    case tmppt1.x() > tmppt2.x():
    w=tmppt2.x() + scroll + (border*2) + wconst
    self.setposition(x,y,w,h)

    ;out vertically
    case tmppt1.y() > tmppt2.y():
    h=tmppt2.y() + scroll + title + (border*2) + hconst
    self.setposition(x,y,w,h)

    ;not out
    otherwise:
    endswitch
    delayscreenupdates(no)
    endMethod

    (You shoud replace the "nameofabutton" with the name of a button or other object that's containesd in the page.)

    b) Sure, but there's no authomatic means of doing this: you can mess with the zoom property of the form, or you can implement a message passing that will make the resizing of the form resize also any control on it, but this will be much work.
    The only failure is not trying to do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •