khchen / wNim

Nim's Windows GUI Framework
MIT License
327 stars 17 forks source link

Update wResizer.nim #120

Open retsyo opened 10 months ago

retsyo commented 10 months ago

fix this issue

wNim\private\wResizer.nim(178, 33) Error: ambiguous identifier: 'wResizable' -- use one of the following:
  wTypes.wResizable: wResizable
  wnim.wResizable:
retsyo commented 10 months ago

you can meet this issue in this code

import winim
import wnim

let app = App(wSystemDpiAware)
let mainForm = Frame()
let panel = Panel(mainForm)

let plus_c = StaticText(panel, label="Hello",  )

proc reSize(ratioX: float, ratioY: float): void =
    plus_c.setPosition( int(16 * ratioX), int(21 * ratioY) )
    plus_c.setSize( int((549-16) * ratioX), int((440-21) * ratioY) )

proc reSizeFont(ratioF: float=1): void =
    plus_c.font = Font(pointSize=9 * ratioF)

mainForm.wEvent_Size do ():
    var
        xy = mainForm.getSize
        x = xy[0]
        y = xy[1]

    var
        ratioX = 0.0
        ratioY = 0.0
        ratioF = 0.0

    panel.setSize(xy)
    ratioX = x / (600+21)
    ratioY = y / (470+47)

    if ratioX >= 1 and ratioY >= 1:
        ratioF = min(ratioX, ratioY)
        reSize(ratioX, ratioY)
        reSizeFont(ratioF)

reSize(1, 1)

mainForm.center
mainForm.show()

app.mainLoop()
veksha commented 9 months ago

reproduces for me too. even with just import wnim/wframe

wnim  [(version: 0.13.3, checksum: eba76f28624eb4c74bdda19830fae74d4dbc1ee2)]
>nim --version
Nim Compiler Version 2.1.1 [Windows: amd64]
Compiled at 2024-01-27
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: f7c6e04cfbc44c225c123d724745840585561ac5
active boot switches: -d:release
>nimble --version
nimble v0.14.2 compiled at 2024-01-27 05:15:25
git hash: a1fdbe8912a0e3dfd30cef030bbabef218d84687