Scroll Bars in a window's frame (from v9.1e)

JLovegren

New Member
I couldn't find a solution, I believe this should be an old topic...
Windows 2025
64-bit OpenEdge v12.8.7

I am updating the application code from v9 to v12.
v9 login window vs v12 login window is shown below.
I did some resizing but regardless of size, the internal frame doesn't fit into the window without centering it and scroll bars.
I am using the same .ini file for the application. I am using the default fonts, MS
I tried toggling pixels vs. characters.
I am running out of hair to pull out.
Attached document has all properties from the v12.
I suspect this was a hot topic decades ago.
1748987844592.png1748987958041.png
 

Attachments

I'm not saying this is the answer, but it might point you in the right direction.

Place this code in the MAIN-BLOCK after the "RUN enable_UI.":

Code:
  Frame DEFAULT-FRAME:VIRTUAL-WIDTH-PIXELS  = C-WIN:Width-pixels - System.Windows.Forms.SystemInformation:BorderSize:Width.
            Frame DEFAULT-FRAME:VIRTUAL-HEIGHT-PIXELS = C-WIN:Height-pixels - System.Windows.Forms.SystemInformation:BorderSize:Height.
      
            Frame DEFAULT-FRAME:WIDTH-PIXELS = C-WIN:Width-pixels - System.Windows.Forms.SystemInformation:BorderSize:Width.
            Frame DEFAULT-FRAME:Height-pixels = C-WIN:Height-pixels - System.Windows.Forms.SystemInformation:BorderSize:Height.

I've also attached working sample code which resizes the frame to match the parent window.

Hope it helps.
 

Attachments

Last edited:
It is interesting. I deleted the image from the frame, then added it back and it scales properly now.
I resized the image several times before this to no avail.

Thank you for your help in this. Obviously, I have much to learn.
 
Progress is nasty when you are resizing. Your logic for resizing a window should take into account whether the user is enlarging or shrinking the window. I have done a lot on resizing for the application I work on, so I do have some experience here.

I worked on a library that could be used for exactly this. It works quite well for windows that are not overly complex. Check it out here: GitHub - patrickTingen/ResizABLe: Generic library to make any screen resizable in the OpenEdge ABL

In short, I found that my best route for making a window resizable is this
  1. Set SCROLLABLE = TRUE on the frame
  2. Increase virtual size of the frame to that of the session
  3. Re-arrange the widgets, use NO-ERROR on each statement that sets size or position
  4. Set virtual size of the frame back that of the window
  5. set SCROLLABLE = FALSE on the frame
  6. Kick out the scrollbars the hard way, just to be sure
Here is my template for "ON WINDOW-RESIZED" that I keep in my snippets-box for making a window resizable:
Code:
DO:
  DEFINE VARIABLE hWindow AS HANDLE  NO-UNDO.
  DEFINE VARIABLE hFrame  AS HANDLE  NO-UNDO.
  DEFINE VARIABLE hBrowse AS HANDLE  NO-UNDO.
  DEFINE VARIABLE iReturn AS INTEGER NO-UNDO.

  &scoped-define SB_HORZ 0
  &scoped-define SB_VERT 1

  ASSIGN
    hWindow = {&WINDOW-NAME}:HANDLE
    hFrame  = FRAME {&FRAME-NAME}:HANDLE
    hBrowse = {&BROWSE-NAME}:HANDLE.

  // Adapt frame to window
  hFrame:SCROLLABLE            = YES.
  hFrame:VIRTUAL-WIDTH-PIXELS  = SESSION:WIDTH-PIXELS.
  hFrame:VIRTUAL-HEIGHT-PIXELS = SESSION:HEIGHT-PIXELS.
  hFrame:WIDTH-PIXELS          = hWindow:WIDTH-PIXELS.
  hFrame:HEIGHT-PIXELS         = hWindow:HEIGHT-PIXELS.

  // Set browse size
  hBrowse:WIDTH-PIXELS  = hFrame:WIDTH-PIXELS - (2 * hBrowse:X) NO-ERROR.
  hBrowse:HEIGHT-PIXELS = hFrame:HEIGHT-PIXELS - hBrowse:Y - 5 NO-ERROR.

  // Set frame size to hide scrollbars
  hFrame:VIRTUAL-WIDTH-PIXELS  = hFrame:WIDTH-PIXELS.
  hFrame:VIRTUAL-HEIGHT-PIXELS = hFrame:HEIGHT-PIXELS.
  hFrame:SCROLLABLE            = NO.

  // force scrollbars to go away
  RUN ShowScrollBar(hFrame:HWND, {&SB_HORZ}, 0, OUTPUT iReturn).
  RUN ShowScrollBar(hFrame:HWND, {&SB_VERT}, 0, OUTPUT iReturn).
END.

PROCEDURE ShowScrollBar EXTERNAL "user32.dll":
  DEFINE INPUT  PARAMETER hwnd        AS LONG.
  DEFINE INPUT  PARAMETER fnBar       AS LONG.
  DEFINE INPUT  PARAMETER fShow       AS LONG.
  DEFINE RETURN PARAMETER ReturnValue AS LONG.
END PROCEDURE.
 
Last edited:
I am not smart enough to understand all of this. I will, however, see if i can understand by using.
As soon as I size all of my windows.

At this point, it seems that Progress changed how to render Windows elements in the gui so it is a long job ahead unless there is something else, like a parameter, that I can use to have it render differently.

I really appreciate your sample code!
 
In that case you might benefit from using the library I mentioned. My suggestion:
  1. Download the file "resizable.p" from Github (or used attached file)
  2. Place it in your codebase.
  3. Remove the code you currently have in the ON WINDOW-RESIZED event
  4. Run resizable.p in the init section of your window.
  5. Profit
 

Attachments

Back
Top