Hiho!
When printing directly onto the display, GetAttribute(#Display,id,#ATTRCURSORX) gives me the actual cursor position, where the next text would be printed.
Is there an equivalent for brushes??
#ATTRCURSORX for Brushes
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: #ATTRCURSORX for Brushes
You mean when using SelectBrush() mode?
Re: #ATTRCURSORX for Brushes
Correct.
I create a brush, select it and print some text in it. Afterwards I need the actual cursor-position inside the brush.
It must be set somewhere, because when printing more text into the brush, It will be printed right after the first text...
I create a brush, select it and print some text in it. Afterwards I need the actual cursor-position inside the brush.
It must be set somewhere, because when printing more text into the brush, It will be printed right after the first text...
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: #ATTRCURSORX for Brushes
Ok, so the way this works is that the cursor position is always reset to 0:0 when calling SelectBrush(). When calling EndSelect(), the old cursor position is restored. Maintaining an individual cursor position for every brush is probably overkill but you could easily stuff this into into your brush objects using SetObjectData(), e.g.
Code: Select all
; use this instead of SelectBrush()
Function p_MySelectBrush(id)
Local cursor_x = GetObjectData(#BRUSH, id, "cursor_x")
Local cursor_y = GetObjectData(#BRUSH, id, "cursor_y")
SelectBrush(id)
Locate(cursor_x, cursor_y)
EndFunction
; use this instead of EndSelect()
Function p_MyEndSelectBrush(id)
Local cursor_x = GetAttribute(#DISPLAY, 0, #ATTRCURSORX)
Local cursor_y = GetAttribute(#DISPLAY, 0, #ATTRCURSORY)
SetObjectData(#BRUSH, id, "cursor_x", cursor_x)
SetObjectData(#BRUSH, id, "cursor_y", cursor_y)
EndSelect
EndFunction
Re: #ATTRCURSORX for Brushes
Cool! That helps a lot!
Thanks for the hint
Best regards
George!
Thanks for the hint
Best regards
George!