Skip to content

Resize Service - minimum window size #8

Description

@TABUllrich

A extension of resize service could make, that a window can't be smaller than a specified size. (the existing function of_SetMinSize ist only a limit for the service functionality not for the window)

// new structure object s_point
long x
long y


// new structor object s_minmaxinfo
s_point ptreserved
s_point ptmaxsize
s_point ptmaxposition
s_point ptmintracksize
s_point ptmaxtracksize


// response resize service
// external functions
subroutine GetMinMaxInfo (ref s_minmaxinfo d, long s, long l) library 'kernel32.dll' alias for "RtlMoveMemory;Ansi" 
subroutine SetMinMaxInfo (long d, s_minmaxinfo s, long l) library 'kernel32.dll' alias for "RtlMoveMemory;Ansi"


// instance variables
protected long il_resizeminwidth = 500          // with setter of_SetResizeMinSize
protected long il_resizeminheight = 200        // with setter of_SetResizeMinSize
protected boolean ib_checkresizeminsize = FALSE     // with setter of_setcheckresizeminsize


// new event pfc_getminmaxinfo (long al_minmaxinfo)
s_MinMaxInfo lstr_MinMaxInfo


IF NOT IsValid (gnv_app) THEN RETURN 0
IF gnv_app.ienv_object.ostype <> windows! and &
        gnv_app.ienv_object.ostype <> windowsnt! THEN RETURN 0

IF ib_checkresizeminsize THEN
    //Populate the structure
    GetMinMaxInfo(lstr_MinMaxInfo, al_minmaxinfo, 40)
    
    //Determine the minimum size of the window (the original size)
    lstr_MinMaxInfo.ptMinTrackSize.x = UnitsToPixels (il_resizeminwidth, XUnitsToPixels!)
    lstr_MinMaxInfo.ptMinTrackSize.y = UnitsToPixels (il_resizeminheight, YUnitsToPixels!)
    
    //Now set the Min/Max info
    SetMinMaxInfo (al_minmaxinfo, lstr_MinMaxInfo, 40)
END IF

return 0


// redirect window event getminmaxinfo (pbm_getminmaxinfo) to service (pfc_w_master)
// this is also necessary in pfc_w_response (if it is resizeable); I don't know why it does not inherit it from master (does not work)
IF NOT IsValid (inv_resize) THEN RETURN

RETURN inv_resize.Event dfscl_getminmaxinfo (minmaxinfo)

(CodePlex Issue #11026)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions