thanks for noting...
SetEvent is a func on Button class, so i can't use it for images
othe thinks can not be a part of parent from ui.Button but images.
it is not a bad idea as you say that all depends on what you want to do with it
I have solved it on the same day, i know there a other function that allow to show onin an onout
add ui on class ImageBox
this function
def OnMouseLeftButtonDown(self):
try:
self.eventDict["MOUSE_BUTTON_DOWN"]()
except KeyError:
pass
This is the use func
def CreateImageButton(self,parent,x,y):
self.image = ui.Imagebox()
self.image.SetParent(parent)
self.image.SetPosition(x,y)
self.image.LoadImage("d:/ymir work/ui/public/Test_button_01.sub")
self.image.SAFE_SetStringEvent("MOUSE_OVER_IN",self.OverOutImage)
self.image.SAFE_SetStringEvent("MOUSE_OVER_IN",self.OverInImage)
self.image.SAFE_SetStringEvent("MOUSE_BUTTON_DOWN",self.PushImage)
self.image.Show()
return self.image
def OverOutImage(self):
self.image.Hide()
self.image.LoadImage("d:/ymir work/ui/public/Test_button_01.sub")
self.image.Show()
def OverInImage(self):
self.image.Hide()
self.image.Loadimage("d:/ymir work/ui/public/Test_button_02.sub")
self.image.Show()
#Push & normal effect
def PushImage(self):
self.image.Hide()
self.image.Loadimage("d:/ymir work/ui/public/Test_button_03.sub")
self.image.Show()
self.image.Hide()
self.image.LoadImage("d:/ymir work/ui/public/Test_button_01.sub")
self.image.Show()
# what happen when push func