My applications needs a transparent multiline text field that the user can move around in a canvas.
With drawstring I programmed a version, that does this with a single line of the string. The size, color and font type of the text could be set with additional controls.
So I hoped there is a possibility to do this with a textarea too, but the textarea always shows a background.
Does anyone has an idea or an other way to solve this?
declare sub setDrawBack lib “Cocoa” selector “setDrawsBackground:” (id As integer, b As boolean)
declare function docView lib “Cocoa” selector “documentView” (id As integer) As integer
The TextAreas Handle points to a XOJScrollView (NSScrollView). You need to turn off background drawing in it and in its documentView which is the actual XOJTextView (NSTextView).
Just noticed you didn’t specify OS and I assumed Above only works on mac, afaik the built in TextArea doesn’t have transparency and you’ll need declares, but haven’t tried Daves idea.
Thanks for your idea, the time will come and I or others need your solution too.
This is the solution:
Get
dim pict as new Picture(1, 1, 32)
if areaText.Text <> "" then
pict = new picture(areaText.Width, areaText.Height)
dim stp as styledTextPrinter
stp = areaText.StyledTextPrinter(pict.graphics, pict.Width)
if stp = nil then
System.DebugLog("stp = nil")
else
stp.DrawBlock(0 , 0, pict.Height)
end if
end if
return pict
End Get
The returned picture is than moved around in the canvas. “areaText” is the Texarea that contains the text that should be moved.