简体   繁体   中英

LUA iup.text cursor trouble

I am trying to use iup.text to create a textbox linked to a text file. I want to display the text file in this textbox in real time.

local Visu = iup.text{ 
    multiline="yes", 
    --rastersize="x60", 
    expand="yes",
    readonly="yes", 
    --font="Times, Bold 12",
    SCROLLBAR="YES",
    AUTOHIDE="YES",
    BGCOLOR="0 43 54",
    fgcolor="255 255 255",
    --maxsize="x1000",
}
function refresh_txt()
    local f2 = io.open("txtfile.txt", "r")
    if not f2 then 
        Visu.value = "Empty File" 
    else
        Visu.value = f2:read("*a")
    end
end

The problem is, when the textbox is just actualized by the function refresh_txt()` the cursor is put at the beginning of the showed text and not at the end of the text as I want. So the text is constantly being refreshed and I can't scroll down because when I did it, the cursor goes to the first character of the first line.

I want an automatic vertical expand of the textbox when refreshed.

I think that the problem can be solved by some argument of iup.text , but I didn't found it.

要在更改文本后向下滚动,请使用VisuQSPI.scrollto =“ 99999999:1”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM