From: <ken...@pp...> - 2007-05-22 10:51:46
|
Hi, I've been all over the net, but have found no decent documentation on this matter, and I simply don't get it to work. I'm only trying to draw a bitmap onto a frame, simple as that. local bitmapFoo = wx.wxBitmap("foo.bmp", wx.wxBITMAP_TYPE_BMP, 300, 400) local dc = wx.wxClientDC(instanceFoo) dc:DrawBitmap(bitmapFoo, 0, 0, false) dc:Delete() What's wrong here...O_O...I don't get it |
From: Hakki D. <dog...@tr...> - 2007-05-22 11:23:39
|
Hi, Kenneth Forsbäck yazmış: > Hi, > > I've been all over the net, but have found no decent documentation on > this matter, and I simply don't get it to work. > > I'm only trying to draw a bitmap onto a frame, simple as that. > > local bitmapFoo = wx.wxBitmap("foo.bmp", wx.wxBITMAP_TYPE_BMP, 300, 400) > local dc = wx.wxClientDC(instanceFoo) > dc:DrawBitmap(bitmapFoo, 0, 0, false) > dc:Delete() > > What's wrong here...O_O...I don't get it > Did you investigate scribble.wx.lua sample? ie. function OnPaint(event) -- ALWAYS create wxPaintDC in wxEVT_PAINT handler, even if unused local dc = wx.wxPaintDC(panel) if bitmap and bitmap:Ok() then if redrawRequired then DrawBitmap(bitmap) redrawRequired = false end dc:DrawBitmap(bitmap, 0, 0, false) end dc:Delete() -- ALWAYS Delete() any wxDCs created when done end -- Regards, Hakki Dogusan |
From: <ken...@pp...> - 2007-05-22 11:39:49
|
Hi, yes, I've looked through scribble.wx.lua, but since I didn't get it to work, I just ignored it and tried something else. here's the actual source I'm working with, and not just a generic example: ---------------------------------------- instanceAbout.lua ---------------------------------------- -- define instanceAbout instanceAbout = wx.wxFrame( instanceSource, wx.wxID_ANY, "About Robin Studio", wx.wxDefaultPosition, wx.wxSize(300, 400), wx.wxCAPTION + wx.wxSTAY_ON_TOP + wx.wxFRAME_NO_TASKBAR ) -- centre instanceAbout instanceAbout:Centre(wx.wxBOTH) -- define aboutBackground local aboutBackground = wx.wxBitmap("interface/about/aboutBackground.bmp", wx.wxBITMAP_TYPE_BMP, 300, 400) -- define aboutPanel local aboutPanel = wx.wxPanel(instanceAbout, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxSize(300, 400)) -- define OnPaint function OnPaint(event) local dc = wx.wxPaintDC(aboutPanel) if aboutBackground and aboutBackground:Ok() then if redrawRequired then DrawBitmap(aboutBackground) redrawRequired = false end dc:DrawBitmap(aboutBackground, 0, 0, false) end dc:Delete() end ---------------------------------------- Hakki Dogusan wrote: > Hi, > > Kenneth Forsbäck yazmış: >> Hi, >> >> I've been all over the net, but have found no decent documentation on >> this matter, and I simply don't get it to work. >> >> I'm only trying to draw a bitmap onto a frame, simple as that. >> >> local bitmapFoo = wx.wxBitmap("foo.bmp", wx.wxBITMAP_TYPE_BMP, 300, 400) >> local dc = wx.wxClientDC(instanceFoo) >> dc:DrawBitmap(bitmapFoo, 0, 0, false) >> dc:Delete() >> >> What's wrong here...O_O...I don't get it >> > > > Did you investigate scribble.wx.lua sample? > > ie. > > function OnPaint(event) > -- ALWAYS create wxPaintDC in wxEVT_PAINT handler, even if unused > local dc = wx.wxPaintDC(panel) > > if bitmap and bitmap:Ok() then > if redrawRequired then > DrawBitmap(bitmap) > redrawRequired = false > end > > dc:DrawBitmap(bitmap, 0, 0, false) > end > > dc:Delete() -- ALWAYS Delete() any wxDCs created when done > end > > > -- > Regards, > Hakki Dogusan > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users |
From: Hakki D. <dog...@tr...> - 2007-05-22 11:54:02
|
Hi, Kenneth Forsbäck yazmış: > Hi, > > yes, I've looked through scribble.wx.lua, but since I didn't get it to > work, I just ignored it and tried something else. > > here's the actual source I'm working with, and not just a generic example: > > ---------------------------------------- > instanceAbout.lua > ---------------------------------------- > [snipped] May I ask a stupid question, did you connent event? panel:Connect(wx.wxEVT_PAINT, OnPaint) panel:Connect(wx.wxEVT_ERASE_BACKGROUND, function(event) end) -- do nothing -- Regards, Hakki Dogusan |
From: <ken...@pp...> - 2007-05-22 12:06:42
Attachments:
instanceAbout.lua
|
Hi, LOL, no I did not connect those events ^_^, and most certainly not a stupid question. However, it still doesn't work! Only thing that changed is that now the panel isn't visible any more, there's only the dark gray background of the frame. ~ Kenneth Hakki Dogusan wrote: > Hi, > > Kenneth Forsbäck yazmış: >> Hi, >> >> yes, I've looked through scribble.wx.lua, but since I didn't get it to >> work, I just ignored it and tried something else. >> >> here's the actual source I'm working with, and not just a generic example: >> >> ---------------------------------------- >> instanceAbout.lua >> ---------------------------------------- >> > [snipped] > > May I ask a stupid question, did you connent event? > > panel:Connect(wx.wxEVT_PAINT, OnPaint) > panel:Connect(wx.wxEVT_ERASE_BACKGROUND, function(event) end) -- do nothing > > > -- > Regards, > Hakki Dogusan > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users |
From: Hakki D. <dog...@tr...> - 2007-05-22 12:16:33
|
Hi, Kenneth Forsbäck yazmış: > Hi, > > LOL, no I did not connect those events ^_^, and most certainly not a > stupid question. > > However, it still doesn't work! Only thing that changed is that now the > panel isn't visible any more, there's only the dark gray background of > the frame. > > ~ Kenneth > Ok, it's painting now :) To be sure, could you please change OnPaint like this: function OnPaint(event) local dc = wx.wxPaintDC(aboutPanel) dc:SetBrush(wx.wxRED_BRUSH) dc:DrawRectangle(0, 0, 100, 100) dc:Delete() -- clean up end If this works, then your bitmap may be faulty.. -- Regards, Hakki Dogusan |
From: <ken...@pp...> - 2007-05-22 12:23:48
|
Hi, yes it works now, I can see the red rectangle. How strange, I even tried making a new image, even tried png instead of bmp, and it still doesn't work O_O. I doubt there's anything wrong with the image... ~ Kenneth Hakki Dogusan wrote: > Hi, > > Kenneth Forsbäck yazmış: >> Hi, >> >> LOL, no I did not connect those events ^_^, and most certainly not a >> stupid question. >> >> However, it still doesn't work! Only thing that changed is that now the >> panel isn't visible any more, there's only the dark gray background of >> the frame. >> >> ~ Kenneth >> > > Ok, it's painting now :) > > To be sure, could you please change OnPaint like this: > > function OnPaint(event) > local dc = wx.wxPaintDC(aboutPanel) > dc:SetBrush(wx.wxRED_BRUSH) > dc:DrawRectangle(0, 0, 100, 100) > dc:Delete() -- clean up > end > > If this works, then your bitmap may be faulty.. > > > -- > Regards, > Hakki Dogusan > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users |
From: Hakki D. <dog...@tr...> - 2007-05-22 12:34:43
|
Hi, Kenneth Forsbäck yazmış: > Hi, > > yes it works now, I can see the red rectangle. How strange, I even tried > making a new image, even tried png instead of bmp, and it still doesn't > work O_O. I doubt there's anything wrong with the image... > > ~ Kenneth > Maybe it's not loading? What is the result of aboutBackground:Ok() ? -- Regards, Hakki Dogusan |
From: <ken...@pp...> - 2007-05-22 12:41:51
|
Hi, indeed, wx.wxMessageBox(tostring(aboutBackground:Ok()), "results", wx.wxOK + wx.wxICON_INFORMATION, instanceAbout) results in false. I tried using an absolute path, but that didn't work either. There's also nothing wrong with the current directory in lua, i.e. the root dir, so the image path is then: "interface/about/aboutBackground.png" ~ Kenneth Hakki Dogusan wrote: > Hi, > > Kenneth Forsbäck yazmış: >> Hi, >> >> yes it works now, I can see the red rectangle. How strange, I even tried >> making a new image, even tried png instead of bmp, and it still doesn't >> work O_O. I doubt there's anything wrong with the image... >> >> ~ Kenneth >> > > Maybe it's not loading? > > What is the result of aboutBackground:Ok() ? > > > > -- > Regards, > Hakki Dogusan |
From: Bradley S. <gm...@ba...> - 2007-05-22 20:20:09
|
Kenneth Forsbäck wrote: > Hi, > > indeed, > > wx.wxMessageBox(tostring(aboutBackground:Ok()), "results", wx.wxOK + > wx.wxICON_INFORMATION, instanceAbout) > > results in false. I tried using an absolute path, but that didn't work > either. There's also nothing wrong with the current directory in lua, > i.e. the root dir, so the image path is then: > "interface/about/aboutBackground.png" > > ~ Kenneth You might want to try this: local aboutBackground = wx.wxBitmapFromFile("interface/about/aboutBackground.bmp", wx.wxBITMAP_TYPE_BMP) |
From: <ken...@pp...> - 2007-05-23 00:27:18
|
Hi, woot, yes! thank you, now it works like a charm ^_^ ~ Kenneth Bradley Smith wrote: > Kenneth Forsbäck wrote: >> Hi, >> >> indeed, >> >> wx.wxMessageBox(tostring(aboutBackground:Ok()), "results", wx.wxOK + >> wx.wxICON_INFORMATION, instanceAbout) >> >> results in false. I tried using an absolute path, but that didn't work >> either. There's also nothing wrong with the current directory in lua, >> i.e. the root dir, so the image path is then: >> "interface/about/aboutBackground.png" >> >> ~ Kenneth > > You might want to try this: > > local aboutBackground = > wx.wxBitmapFromFile("interface/about/aboutBackground.bmp", > wx.wxBITMAP_TYPE_BMP) > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users |
From: Hakki D. <dog...@tr...> - 2007-05-22 13:51:55
|
Hi, Kenneth Forsbäck yazmış: > SGksCgppbmRlZWQsCgp3eC53eE1lc3NhZ2VCb3godG9zdHJpbmcoYWJvdXRCYWNrZ3JvdW5kOk9r [snipped, image?] In addition to checking aboutBackground:Ok(), using an absolute path for image could be useful.. -- Regards, Hakki Dogusan |
From: John L. <jla...@gm...> - 2007-05-22 14:45:52
|
T24gNS8yMi8wNywgSGFra2kgRG9ndXNhbiA8ZG9ndXNhbmhAdHIubmV0PiB3cm90ZToKPiBIaSwK Pgo+IEtlbm5ldGggRm9yc2LkY2sgeWF6bf3+Ogo+ID4gU0drc0NncHBibVJsWldRc0NncDNlQzUz ZUUxbGMzTmhaMlZDYjNnb2RHOXpkSEpwYm1jb1lXSnZkWFJDWVdOclozSnZkVzVrT2s5cgo+IFtz bmlwcGVkLCBpbWFnZT9dCj4KPgo+IEluIGFkZGl0aW9uIHRvIGNoZWNraW5nIGFib3V0QmFja2dy b3VuZDpPaygpLCB1c2luZyBhbiBhYnNvbHV0ZSBwYXRoIGZvcgo+IGltYWdlIGNvdWxkIGJlIHVz ZWZ1bC4uCgpUcnkgdXNpbmcgd3gud3hHZXRDd2QoKSB0byBzZWUgd2hhdCBkaXIgd3hXaWRnZXRz IHdvdWxkIHVzZSBmb3IKbG9hZGluZyB0aGUgYml0bWFwLgoKUmVnYXJkcywKICAgIEpvaG4gTGFi ZW5za2kK |
From: <ken...@pp...> - 2007-05-22 14:52:44
|
the script is launched from "i:\src\studio\" and the CWD is the same, so the image path "interface/about/aboutBackground.png" is corret. I even tried with an absolute path "i:\src\studio\interface\about\aboutBackground.png", and it still doesn't work O_O John Labenski wrote: > > Try using wx.wxGetCwd() to see what dir wxWidgets would use for > loading the bitmap. |