News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
screen corruption issue
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: screen corruption issue

That's odd.

I looked at it again, quickly, and can't see anything wrong with it. I have no experience using Fltk in modules, so for all I know maybe there's an issue with that. I tried moving the require to the start of the file and that didn't help. Tried adding your window:redraw() back in, and that didn't help.

One thing you can do that seems to work is use dofile() instead of require. This would mean having to make sure your variable names are unique, which for the most part they are. Personally I think modules seem to be a lot cleaner, but I don't have enough experience with them to do much debugging.

My test changes:

Code:
-- testindex.lua

local win = fltk:Fl_Double_Window(366, 500,"MurgaLua Test Manager")

local button=fltk:Fl_Button(50,27,24,24)
button:callback(function()
--require "testadmin"
--testadmin.window:show()
dofile("testadmin.lua")
end)

win:show()
Fl:run()

Code:
-- testadmin.lua

--module("testadmin", package.seeall)

local ww=400 --window width
local wh=350 --window height
local col=ww/4
local col2=ww-col -- column widths
local b
local br_two

function list_callback(w)
local colnames={'a','b','c','d','e','f'}
local colcount = # colnames
local colwidths = {}
for i=1,colcount do colwidths[i] = string.len(colnames[i]) * b:labelsize() end
table.insert(colwidths,0)

b:clear()
b:column_widths(colwidths)
b:column_char(string.byte('|'))

local header=""
for i=1,colcount do
if i> 1 then header=header.."|" end
header=header.."@B12@C7@b@."..colnames[i]
end
b:add(header)

for r=1,2500 do
local data=""
for i=1,colcount do
if i> 1 then data=data.."|" end
data=data..string.format("rc%d %d", r,i)
end
b:add(data)
end

Fl:check()
--window:redraw()
end

window = fltk:Fl_Double_Window(ww, wh, "test admin")

local nameedit = fltk:Fl_Input(200,0,100,25,'Name of this view...........:')
br_two=fltk:Fl_Hold_Browser(0,50,col,wh-75,"Fl_Hold_Browser")
br_two:add('1')
br_two:add('2')
br_two:add('3')
br_two:callback(list_callback)

b = fltk:Fl_Hold_Browser(col,50,col2,wh-75,"Table Browser")

fltk:Fl_End() -- end of window

--following two lines are significant to the problem!
window:show()
Fl:run()

07-31-2011 01:40 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
screen corruption issue - roydobbins - 07-29-2011, 04:12 AM
RE: screen corruption issue - mikshaw - 07-30-2011, 12:10 AM
RE: screen corruption issue - roydobbins - 07-30-2011, 07:52 AM
RE: screen corruption issue - mikshaw - 07-31-2011, 12:40 AM
RE: screen corruption issue - roydobbins - 07-31-2011, 04:43 AM
RE: screen corruption issue - mikshaw - 07-31-2011, 10:26 AM
RE: screen corruption issue - mikshaw - 07-31-2011, 10:46 AM
RE: screen corruption issue - roydobbins - 07-31-2011, 12:06 PM
RE: screen corruption issue - mikshaw - 07-31-2011 01:40 PM
RE: screen corruption issue - roydobbins - 08-02-2011, 12:22 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: