Disabling wrap on TextArea doesn't work (Windows)
GrimStride opened this issue · 3 comments
GrimStride commented
Just what the title says. I have this simple code based on the example:
import nigui
app.init()
var root = newWindow()
var container = newLayoutContainer(Layout_Horizontal)
root.add(container)
var buttons = newLayoutContainer(Layout_Vertical)
container.add(buttons)
var btn_open = newButton("Open")
btn_open.widthMode = WidthMode_Fill
var btn_save = newButton("Save")
btn_save.widthMode = WidthMode_Fill
var btn_saveas = newButton("Save As...")
btn_saveas.widthMode = WidthMode_Fill
buttons.add(btn_open)
buttons.add(btn_save)
buttons.add(btn_saveas)
var txt = newTextArea()
txt.wrap = false
container.add(txt)
root.show()
app.run()
But text is still wrapped. Here's the output from nimble so you can verify i have the latest version:
>nimble dump nigui
name: "nigui"
version: "0.2.5"
author: "Simon Krauter"
desc: "Cross-platform, desktop GUI toolkit using native widgets."
license: "MIT"
skipDirs: ""
skipFiles: ""
skipExt: ""
installDirs: ""
installFiles: ""
installExt: ""
requires: "nim >= 0.19.0"
bin: ""
binDir: ""
srcDir: "src"
backend: "c"
theAkito commented
Indeed, can confirm this issue. Same here.
GrimStride commented
Just found the root of the problem. This procedure in /private/windows/platform_impl.nim
:
proc init(textArea: NativeTextArea) =
var dwStyle: int32 = WS_CHILD or ES_MULTILINE or WS_VSCROLL # with wrap
# var dwStyle: int32 = WS_CHILD or ES_MULTILINE or WS_VSCROLL or WS_HSCROLL # no wrap
var dwExStyle: int32 = WS_EX_CLIENTEDGE
textArea.fHandle = pCreateWindowExWithUserdata("EDIT", dwStyle, dwExStyle, pDefaultParentWindow, cast[pointer](textArea))
pTextAreaOrigWndProc = pSetWindowLongPtr(textArea.fHandle, GWLP_WNDPROC, pTextAreaWndProc)
textArea.TextArea.init()
if you swap the commented line with the un-commented line, it works.
i guess this wrap feature is just not fully implemented yet.
simonkrauter commented
You are right, it's not implemented yet. I found this comment:
method `wrap=`(textArea: NativeTextArea, wrap: bool) =
procCall textArea.TextArea.`wrap=`(wrap)
# TODO: allow to enable/disable word draw at runtime
# It seems that this is not possible.
# Word wrap depends on whether dwStyle contains WS_HSCROLL at window creation.
# Changing the style later has not the wanted effect.