Announcement

Collapse
No announcement yet.

Layout32 Resize Library

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Layout32 Resize Library

    Layout32, a resize engine that can be used to lay out controls on a window, or resize them, or both.
    You can now take the demo version for a test run or order the commercial version.

    Layout32 is a powerful, easy to use, and intuitive resize engine for the Microsoft Windows programmer.
    It is rules-based, meaning that there is no need to fiddle around with confusing docking and anchor properties.
    To make the following window fully resizeable, all that is needed are two easy to understand rules that describe
    what one sees visually when the form is resized.






    Layout_AddRule hWnd, Stretch, Right, MakLng(IDC_FORM1_EDIT1, IDC_FORM1_EDIT6), Right
    Layout_AddRule hWnd, Move, Right, MakLng(IDC_FORM1_TEXTBTN1, IDC_FORM1_LISTVIEW1), Right

    Or in plain English

    Stretch the Right side of the controls from Edit1 to Edit6 relative to the Right side of the form.
    Move the Right side of the controls from Button1 to the List-view relative to the Right side of the form.


    Dynamic Forms

    But there is more, a form can be built dynamically, for example, a data entry screen that is
    based on data stored in a database. The controls can initially be created with no particular
    size, position, and discernible relationship to each other and then laid out using a set of rules.






    Who can use it

    The Layout32 can be used from any computer programming language that supports
    Dynamic Link Libraries(DLL). The package comes with two versions:
    • A fully operational distributable DLL or SLL without debugging features.
    • A fully operational developer DLL or SLL with debugging features.



    DDT code for a simple resizable dialog

    Code:
    #Dim All
    #Register None
    #Compile Exe
    #Option Version4
    
    ' The following constants define the minimum required platform.  The minimum required
    ' platform is the earliest version of Windows, Internet Explorer etc. that has the
    ' necessary features to run your application.  Wnen defined, they enable features
    ' available on platform versions up to and including the version specified.
    %NTDDI_VERSION                              = &H05010000
    %WINVER                                     = &H0501
    %WIN32_WINNT                                = &H0501
    %WIN32_IE                                   = &H0600
    %UNICODE                                    = 1
    
    #Include Once "WIN32API.INC"
    
    #Include "Layout32_sll.inc"
    
    #Link "Layout32.sll"
    
    #Resource Manifest, 1, "Resize.xml"
    
    '--------------------------- [ Control Identifiers ] ---------------------------
    
    %IDC_FORM1_EDIT1                            = 101
    
    Global  hDlg          As DWord    ' handle of top-level dialog
    
    '-------------------------------------------------------------------------------
    
    Function PBMain () As Long
    
      Dialog New Pixels, 0, "Introducing Layout32", , , 299, 163, %WS_Popup Or %WS_Caption Or %WS_ThickFrame Or _
        %WS_SysMenu Or %WS_ClipChildren Or %WS_Visible Or %DS_ModalFrame Or %DS_3DLook Or %DS_NoFailCreate Or _
        %DS_SetFont, %WS_Ex_ControlParent Or %WS_Ex_Composited, To hDlg
    
      Control Add TextBox, hDlg, %IDC_FORM1_EDIT1, "", 12, 12, 275, 110, %WS_Child Or %WS_Visible Or %WS_ClipSiblings Or _
        %WS_Border Or %WS_TabStop Or %WS_HScroll Or %WS_VScroll Or %ES_Left Or %ES_MultiLine Or %ES_AutoHScroll Or _
        %ES_AutoVScroll, %WS_Ex_ClientEdge
      Control Add Button,  hDlg, %IdOk, "OK", 71, 128, 75, 23, %WS_Child Or %WS_Visible Or %WS_ClipSiblings Or _
        %WS_TabStop Or %BS_PushButton Or %BS_Center Or %BS_VCenter
      Control Add Button,  hDlg, %IdCancel, "Cancel", 152, 128, 75, 23, %WS_Child Or %WS_Visible Or %WS_ClipSiblings Or _
        %WS_TabStop Or %BS_PushButton Or %BS_Center Or %BS_VCenter
    
      ' Rules
      Layout_AddRule hDlg, %Stretch, %Right, %IDC_FORM1_EDIT1, %Right
      Layout_AddRule hDlg, %Stretch, %Bottom, %IDC_FORM1_EDIT1, %Bottom
      Layout_AddRule hDlg, %HCenter, %Group, MakLng(%IdOk, %IdCancel)
      Layout_AddRule hDlg, %Move, %Bottom, MakLng(%IdOk, %IdCancel), %Bottom
      ' Limits
      Layout_AddLimit hDlg, %Form, 307, 200
    
      ' Display the dialog box
      Dialog Show Modal hDlg
    
    End Function
    The demo is fully functional and has the same DLLs and SLLs as the commercial version.
    Last edited by Dominic Mitchell; 27 Jul 2014, 10:25 PM.
    Dominic Mitchell
    Phoenix Visual Designer
    http://www.phnxthunder.com

  • #2
    Dominic,
    Will we have to add:
    Portions Copyright © 1995 Jeffrey Richter
    when using these.

    James
    Last edited by jcfuller; 26 Jul 2014, 05:00 PM.

    Comment


    • #3
      It is already present in the header file.

      Code:
      '                        Acknowledgements
      ' Jeffrey Richter:
      ' For his original implementation of a layout algorithm which positions
      ' controls in a window based on a set of rules.
      
      ' Notice: Portions Copyright © 1995 Jeffrey Richter
      
      ' Action to perform
      %STRETCH = 0        ' Metric should be stretched
      %MOVE    = 1        ' Control should be moved
      %VCENTER = 2        ' Vertically center control/group
      %HCENTER = 3        ' Horizontally center control/group
      
      ' Part to act on or relative to
      %LEFT    = 0        ' Left side of control
      %TOP     = 1        ' Top side of control
      %RIGHT   = 2        ' Right side of control
      %BOTTOM  = 3        ' Bottom side of control
      %WIDTH   = 4        ' Width of control
      %HEIGHT  = 5        ' Height of control
      %CONTROL = 6        ' Group(one control)
      %WIDGET  = %CONTROL ' Widget and Control are synonymous
      %GROUP   = 7        ' Group(two controls acting as limits for a range of controls)
      
      ' Scale mode
      %SCALEMODE_NONE     = -1
      %SCALEMODE_DPI      = 0
      %SCALEMODE_FONT     = 1
      %SCALEMODE_DIALOG   = 2
      
      ' Special value indicating that the window
      ' being acted relative to is the form
      %FORM      = &H7FFFFFFE&
      
      ' Special value indicating that the maximum
      ' size of a window is umlimited
      %NOLIMIT            = 0
      Last edited by Dominic Mitchell; 26 Jul 2014, 02:46 PM.
      Dominic Mitchell
      Phoenix Visual Designer
      http://www.phnxthunder.com

      Comment


      • #4
        > Portions Copyright © 1995 Jeffery Richter

        Spelling correction: It is Jeffrey, not Jeffery.
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Corrected, thanks.
          Dominic Mitchell
          Phoenix Visual Designer
          http://www.phnxthunder.com

          Comment


          • #6
            Excellent piece of work, makes resizing quick and stress free

            Comment


            • #7
              Thanks for the compliments.
              Dominic Mitchell
              Phoenix Visual Designer
              http://www.phnxthunder.com

              Comment


              • #8
                Dominic,

                This looks great! I am going to download the demo and play around with it.

                Also, want to make you aware that when I clicked the "Order Layout32 Resize Library" link, I received the following error. The requested URL /buy2.html was not found on this server.

                Thanks,
                Gary
                Thanks,
                Gary Stout
                gary at sce4u dot com

                Comment


                • #9
                  Thanks, broken link has been fixed.
                  Dominic Mitchell
                  Phoenix Visual Designer
                  http://www.phnxthunder.com

                  Comment


                  • #10
                    Demo reuploaded

                    The demo has been reuploaded. This fixes a major blunder, at least from the vendor's point of view.
                    Dominic Mitchell
                    Phoenix Visual Designer
                    http://www.phnxthunder.com

                    Comment


                    • #11
                      Layout rules location note follows...
                      Last edited by Dominic Mitchell; 27 Apr 2016, 06:56 AM.
                      Dominic Mitchell
                      Phoenix Visual Designer
                      http://www.phnxthunder.com

                      Comment


                      • #12
                        The location of the layout rules.

                        Code defining the layout rules can be placed in PBMAIN / WINMAIN or any windows message except the WM_SIZE message.

                        Give Layout32 a try, it makes creating fully resizeable windows/dialogs very easy.
                        Dominic Mitchell
                        Phoenix Visual Designer
                        http://www.phnxthunder.com

                        Comment


                        • #13
                          I've been using the commercial version for quite a while now and it works perfectly, looks tidy and saves time in creating new client apps.

                          Comment


                          • #14
                            Is it DPiAware and work with PBForms?
                            https://duckduckgo.com instead of google

                            Comment


                            • #15
                              Anybody know if it works on 4K monitors that use scaling?
                              Need to use Jose Roca routines?
                              https://forum.powerbasic.com/forum/u...-cwindow-class
                              https://duckduckgo.com instead of google

                              Comment


                              • #16
                                I use it with PBForm generated forms without problem. I use QHD monitors again without problem, but I've not tried it with 4K resolutions or with scaling

                                Comment


                                • #17
                                  I believe it is DPI aware, but in some programs a Windows shortcut property needs to be changed to start correctly.

                                  Click Compatibility
                                  Change high DPI settings from "when I open this program" to "when I signed into Windows."

                                  After doing that everything is resizing correctly on a 4K monitor using different scales.
                                  https://duckduckgo.com instead of google

                                  Comment


                                  • #18
                                    Could not get resize demo to resize properly at 3840 x 2160 with scale of 300% (suggested by Windows.)
                                    https://duckduckgo.com instead of google

                                    Comment

                                    Working...
                                    X