Forum > Beginners
Draw Directly on TBitmap
(1/1)
trayres:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var bmp: TBitmap; begin bmp := TBitmap.Create;bmp.SetSize(600,600); <- This is causing a segfault{Draw some stuff}end.
In file lclintf.inc at line 177:
Result:=WidgetSet.RawImage_QueryDescription(AFlags,ADesc);
This looks a lot like example code from Delphi; I think something isn't being initialized correctly?
I started from a simple console project, and added LCL as a required package to get the Graphics module.
Any thoughts all?
Thanks!
JZS:
With Lazarus 1.6 on Windows this piece of code compiles/runs successfully.
Probably you need to mention the version you are using, and on which platform!
Leledumbo:
--- Quote from: trayres on March 28, 2016, 07:49:22 am ---This looks a lot like example code from Delphi; I think something isn't being initialized correctly?
I started from a simple console project, and added LCL as a required package to get the Graphics module.
--- End quote ---
Nah, Delphi doesn't have widgetset concept. The missing thing is Interfaces unit, since the code queries underlying widgetset which won't exist if you omit Interfaces from uses clause.
Handoko:
It works on my Lazarus installation. Just as Leledumbo said, Lazarus is not Delphi. You better start your new project by clicking: menu > File > New > Application. By doing that, it will automatically put necessaries units in the uses clause.
Or you can simply download my sample project for testing
trayres:
--- Quote from: Leledumbo on March 28, 2016, 01:35:01 pm ---
--- Quote from: trayres on March 28, 2016, 07:49:22 am ---This looks a lot like example code from Delphi; I think something isn't being initialized correctly?
I started from a simple console project, and added LCL as a required package to get the Graphics module.
--- End quote ---
Nah, Delphi doesn't have widgetset concept. The missing thing is Interfaces unit, since the code queries underlying widgetset which won't exist if you omit Interfaces from uses clause.
--- End quote ---
This was exactly the problem. Thank you! Adding the Interfaces unit solved it, and now I know how to get an LCL program running without going through the wizard (so I have a better idea of what's going on).
Much appreciated!
Navigation
[0] Message Index