Jump to content
Phishing - Beware of identity theft... ×
  • 0

[Help]Imagebox click function


Noa

Question

hey, first happy new year.

 

i create this board and this fake button https://metin2.download/picture/Lu1Pm8avlf15kKe09R393UcqQu3y3Svg/.png

it's a Imagebox, my problem ist to give a click function 

 

there are this func onMouseLeftButtonUpEvent but it works only on window wndMgr

 

so there ar other click event functions on images ?

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
self.TestButton = ui.Button()
self.TestButton.SetParent(self)
self.TestButton.SetPosition(20, 13)
self.TestButton.SetUpVisual("d:/ymir work/ui/public/Test_button_01.sub")
self.TestButton.SetOverVisual("d:/ymir work/ui/public/Test_button_02.sub")
self.TestButton.SetDownVisual("d:/ymir work/ui/public/Test_button_03.sub")
self.TestButton.SetToolTipText(locale.Test, 0, - 23)
self.TestButton.SetEvent(ui.__mem_func__(self.Test))
self.TestButton.Show()
 

 

 

def Test(self):
      self.close

 

 

so much simpler

 

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.