Widget Issue

Opera

Deity
Joined
Sep 21, 2008
Messages
4,643
Hey there!

I've been adding a new bar in the city screen; I thus added a new widget to show info on mouseover. My issue is that the mouseover only work when I hover the bottom border of the bar... not when I hover any other part of it.

Any idea what might be wrong?
 
I can't think of anything off of the top of my head. What does the code used to generate the widget look like?
 
Code:
		screen.addStackedBarGFC( "OperaBar", 16, yResolution - 240, 220, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_HELP_OPERA, -1, -1 )
		screen.setStackedBarColors( "OperaBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_PLAYER_DARK_RED") )
		screen.setStackedBarColors( "OperaBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_EMPTY") )
		screen.setStackedBarColors( "OperaBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY") )
		screen.setStackedBarColors( "OperaBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
		screen.hide( "OperaBar" )
And also:
Code:
				iValue = pHeadSelectedCity.getValue()
				szBuffer = u"Value: %d%%" %(iValue)
				screen.setLabel( "OperaText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, 125, yResolution - 236, -1.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
				[B]screen.setHitTest( "OperaText", HitTestTypes.HITTEST_NOHIT )[/B]
				screen.show( "OperaText" )
				screen.setBarPercentage( "OperaBar", InfoBarTypes.INFOBAR_STORED, float(iValue) / float(gc.getDefineINT("OPERA_MAX_VALUE")))
				screen.show( "OperaBar" )
(I used Value and OperaBar as dummy names as the content of what I'm doing is kinda secret for now :p)

Could it have something to do with the bolded part?
 
Does the problem only occur in the area where the label is covering the bar?
 
The NO_HITTEST should allow the mouseover and clicking to "phase through" your text. To test if that is failing, just remove the text completely. WIDGET_HELP_OPERA is what you assigned the new hover text to, correct?

How close do you have this bar to other screen elements? It could be that something is sitting on top of it and overrides the mouseover. Use a MoveToFront command at the end of Update to ensure that absolutely nothing is on top of this widget, if that helps, then find and move the offending piece, move your new bar, or some other compromise :)
 
Thanks xienwolf, it really was another element covering my new bar :)
I just reduced that element's height and it's good now :D
 
Top Bottom