Notifications
Clear all

[Closed] edittext pressed event?

I’m just wondering if there’s and event that I can use to clear the edittext.text when a person clicks into it to enter their own text.

something like:


rollout testenteremail "Testing Enter Your Email" width: 230
(
	edittext enteryouremail "Email: "
	on testenteremail open do
	(
		enteryouremail.text = "Enter Your Email Here"
	)
	on enteryouremail entered txt do
	(
		txt = ""
	)
)
createdialog testenteremail

but it seems the entered event doesnt do what its name suggests, instead it only works if theres another edittext in the rollout and after they put in text into one edittext and go into another edittext.

sorry if this has been covered before, I couldnt find a maxscript solution to this, and I’m clueless about dotnet, but I’ve read something about having dotnet do it, still unclear as to how.

Thanks in advance.

7 Replies
1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

not too much we can do using just MXS. here is some solution:


 try(destroyDialog typeHere) catch()
 rollout typeHere "Type Here" width:200
 (
 	edittext edt text:"Type here" width:190 align:#center 
 		
 	local typed = off
 	on edt changed text do
 	(
 		if not typed do edt.text = ""
 		typed = on
 	)
 	on edt entered text do 
 	(
 		typed = off
 		format ">> %
" text
 		edt.text = "Type here"
 		setfocus typeHere
 	)
 )
 createDialog typeHere
 

the shortcoming of this implementation is that we are loosing first typed symbol.

this scenario can be easy realized with .NET controls, but as I see it’s not a point.

Hi,
You could implement a mouse click handler for the rollout, and check the clicked position to clear the editText text, or use the .focus of the control within a timer.

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

hmm… i don’t see how both these ideas can work:
#1 no rollout mouse click event fires if user clicked on an area covered by any rollout control.
#2 there is no #focus property for rollout controls, and there is no any focus related event handler.

that sounds like the perfect solution, could you possibly post an example for me? I’ve never used this method for anything.

Thanks Again Dennis, So with maxscript alone we CANT accomplish the goal, we can only clear it when its typed into but not clicked into, right?

Whats the .NET solution? and will it work if encrypted to .mse?

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

using MXS only we can’t catch focus change or mouse click events for edittext control.

there are several solutions with using of .net. try to find any yourself. show it here, and we will try to make it work.

i don’t answer any more any question about the max script encrypting.

 lo1

Yes, it will.