Notifications
Clear all

[Closed] GW text pos related problem ! Please help

Hey everyone , i writte gw text like this


unRegisterRedrawViewsCallback drawThis

scrSize=getViewSize()
posInScreen=[scrSize.x/2,(scrSize.y-(scrSize.y/2)) ,0]
boxHW=[215,16] 

fn drawThis =
(
	gw.setTransform(Matrix3 1)
	
	messageText=#("Click = Instance object paint !","Ctrl+Click = Copy object paint !",
		"Shift+Click = Put object paint on surface !","Shift+Click = Rotate object paint 90 deg","Right Click = Finish painting !")
	boxColor = (color 238 204 73)
	TextColor = black
		
	BoxPosX=(posInScreen.x-10)
	BoxPosY=(posInScreen.y-15)
		
	TextPosX=posInScreen.x
	TextPosY=posInScreen.y
	TextPosZ=posInScreen.z
		
	for i in messageText do
	(	
		txtRect = (box2 BoxPosX BoxPosY boxHW.x boxHW.y) --(box2 (pos.x) (pos.y) width height  )
		gw.wrect txtRect boxColor
		gw.wText [TextPosX,TextPosY,TextPosZ] i color:TextColor
		BoxPosY +=18
		TextPosY +=18
	)
	gw.enlargeUpdateRect #whole
	gw.updateScreen()
)

unRegisterRedrawViewsCallback drawThis
registerRedrawViewsCallback drawThis
drawThis ()
forceCompleteRedraw()

the problem I have is : whenever I try to change from maximaze the viewport/single viewport from little viewport [4 view or 2 viewport] it change the pos , can I make it static not moving when I try to maximaze or minimize the viewport ,like viewport title ?

gw text in minimized viewport

gw text in maximaze viewport pos

Thank you for the help

2 Replies

get an active view size and calculate posInScreen value every time inside the drawThis function

OK I got the image…

Thank you very much