none
Aligning TextWindow with GraphicsWindow RRS feed

  • Question

  • I have been using SmallBasic with a Windows 8.1 64 Bit computer and I can't get the TextWindow to top align with the GraphicWindow with the following code:

    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Width = 480  ' Same as background image
    GraphicsWindow.Height = 360  ' Same as background image
    GraphicsWindow.Top = 200  ' Position on your desktop
    GraphicsWindow.Left = 50   ' Position on your desktop
    TextWindow.Top = GraphicsWindow.Top
    TextWindow.Left = GraphicsWindow.Left + GraphicsWindow.Width + 15

    Is there a way to fix this?

    Sunday, June 5, 2016 7:54 PM

Answers

  • I think it may be due to the display and GW scaling not being the same, depending on you display dpi.

    For mine on Windows 10 I need:

    TextWindow.Top = GraphicsWindow.Top*1.25
    TextWindow.Left = (GraphicsWindow.Left + GraphicsWindow.Width)*1.25

    There are extension to detect and do these conversions, but otherwise try a scaling depedning on you dpi.


    Monday, June 6, 2016 5:31 PM
    Moderator

All replies

  • On WIN 7 PRO 64 Bit it runs nearly correct.

    The Textwindow is 5 Pixel lower than GW. This can be adjusted by program.

    I think that is no fix offset and you need an Environment Variable. Horizontal too.

    Sunday, June 5, 2016 8:39 PM
  • RBSSBR, I'm seeing the same thing you are in Windows 10. I have no idea what the cause is, but I think it is related to the GUI changes for Windows Windows 8, and Windows 10. I have had a couple of SmallBasic programs that accessed the desktop break in different ways.

    This is probably a small bug in Small Basic.

    Monday, June 6, 2016 1:53 PM
    Answerer
  • I think it may be due to the display and GW scaling not being the same, depending on you display dpi.

    For mine on Windows 10 I need:

    TextWindow.Top = GraphicsWindow.Top*1.25
    TextWindow.Left = (GraphicsWindow.Left + GraphicsWindow.Width)*1.25

    There are extension to detect and do these conversions, but otherwise try a scaling depedning on you dpi.


    Monday, June 6, 2016 5:31 PM
    Moderator
  • Default GW (client area) dimensions: 624 x 442    (CanResize = "True")

    with CanResize = "False": 634 x 452   ->  dW = dH = 10

    see the 'CanResize Effect' by click into GW.

    gt = 200
    gl = 50
    gw = 480
    
    GraphicsWindow.Top = gt
    GraphicsWindow.Left = gl
    GraphicsWindow.Width = gw
    GraphicsWindow.Height = 360 ' gh
    TextWindow.Top = gt
    TextWindow.Left = gl + gw + 15
    
    OnMouseDown()
    GraphicsWindow.MouseDown = OnMouseDown
    
    Sub OnMouseDown
      bResize = LDLogic.Not(bResize)
      GraphicsWindow.Title = "CanResize = "+ bResize
      GraphicsWindow.CanResize = bResize
      'GraphicsWindow.CanResize = LDLogic.Not(GraphicsWindow.CanResize)
    EndSub

    Monday, June 6, 2016 8:02 PM
    Answerer