tv_GetMouse, is there a tv_SetMouse X Y ?

A forum dedicated to George scripting questions
Post Reply
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Svengali »

If I can capture the X Y position of the mouse cursor, why can't I set it?

In the MENUTEST script below, each time the menu is re-displayed, it appears at the current cursor X Y position... if I could reset the mouse cursor back to it's original position the menu would redisplay in its original position... I think.

So, is there some reason the tv_SetMouse X Y command doesn't exist?

Code: Select all

// MenuTest.grg
// Can we improvise an updatable menu?

Param None
ScriptName = "MenuTest"

OptionA = "Red On"
OptionB = "Blue On"

menu = -1
tv_GetMouse
parse result Mx My

WHILE (menu == -1)
	
	// =========================================
	tv_SetMouse Mx My  // this command doesn't exist
	// =========================================

	MenuInfo = OptionA "|" OptionB "| Exit"

	tv_ListRequest MenuInfo
	parse result Choice ChoiceText

	
	
	IF (Choice == -1) || (Choice == 2)
		menu = 0
	END

	IF (Choice == 0)
		Match = CMP(OptionA, "Red On")
		IF Match
			OptionA = "Red Off"
		ELSE
			OptionA = "Red On"		
		END
	END

	IF (Choice == 1)
		Match = CMP(OptionB, "Blue On")
		IF Match
			OptionB = "Blue Off"
		ELSE
			OptionB = "Blue On"
		END
	END
END

Thanks, Sven
User avatar
Hervé
Site Admin
Posts: 3490
Joined: 08 Feb 2006, 17:00
Location: Metz France
Contact:

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Hervé »

Svengali wrote: So, is there some reason the tv_SetMouse X Y command doesn't exist?
Because it makes no sense with a wacom tablet.
Hervé ADAM, TVPaint Team
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Svengali »

Hervé wrote: 30 Sep 2009, 16:01
Svengali wrote: So, is there some reason the tv_SetMouse X Y command doesn't exist?
Because it makes no sense with a wacom tablet.
Over 10 years ago, I posted a question/request for a new GEORGE command: tv_SetMouse X Y...

After all these years, I STILL WOULD REALLY LIKE TO BE ABLE SCRIPT IN A SPECIFIC CURSOR X Y SETTING...
Why? Because I often want to display an interactive popup message or list of choices for the user at a specific screen location.

The way it works now, the message or list ALWAYS POPS UP with its upper-left corner on the X, Y position where the mouse was clicked (most often some where on the button just pressed).
If it were possible, in a script, to allow GEORGE to SET the mouse cursor to a specific place on the screen, then the upper-left corner of the popup message or list could be predictably and precisely placed at any specific place on the screen every time.

So, to renew an extremely old request: could we possibly add a new GEORGE command: tv_SetMouse X Y ?

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
Thierry
Site Admin
Posts: 2780
Joined: 07 Jan 2013, 08:28

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Thierry »

I see no reason why we couldn't have this in the software today.
I've added this in the todo list.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Svengali »

Thierry wrote: 27 Oct 2020, 14:45 I see no reason why we couldn't have this in the software today.
I've added this in the todo list.
thanks, I think scripters will make good use of this. :)
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Xavier
Posts: 1855
Joined: 01 Oct 2019, 11:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Xavier »

Thanks for popping out your former proposals !
Xavier
Posts: 1855
Joined: 01 Oct 2019, 11:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Xavier »

Svengali wrote: 23 Oct 2020, 22:54 Why? Because I often want to display an interactive popup message or list of choices for the user at a specific screen location.

The way it works now, the message or list ALWAYS POPS UP with its upper-left corner on the X, Y position where the mouse was clicked (most often some where on the button just pressed).
If it were possible, in a script, to allow GEORGE to SET the mouse cursor to a specific place on the screen, then the upper-left corner of the popup message or list could be predictably and precisely placed at any specific place on the screen every time.

So, to renew an extremely old request: could we possibly add a new GEORGE command: tv_SetMouse X Y ?

sven
From the code I've checked, tv_getmouse returns (should return) the position of the cursor WITHIN the picture, which is quite different from the coordinates you can see in the infobar, at the bottom left :
Capture d’écran_2021-06-10_15-23-15.png
Capture d’écran_2021-06-10_15-23-15.png (12.22 KiB) Viewed 7277 times

If I properly understood your request, this is not what you need. You'd rather need two new George functions :
  • tv_GetScreenPosition would return the position of the mouse in the screen
  • tv_SetScreenPosition sets the cursor position in the screen
Do you agree ?
Xavier
Posts: 1855
Joined: 01 Oct 2019, 11:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Xavier »

But maybe a George function to trigger a menu item would make more sense, what do you think ?
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Svengali »

Xavier wrote: 10 Jun 2021, 15:33
Svengali wrote: 23 Oct 2020, 22:54 Why? Because I often want to display an interactive popup message or list of choices for the user at a specific screen location.

The way it works now, the message or list ALWAYS POPS UP with its upper-left corner on the X, Y position where the mouse was clicked (most often some where on the button just pressed).
If it were possible, in a script, to allow GEORGE to SET the mouse cursor to a specific place on the screen, then the upper-left corner of the popup message or list could be predictably and precisely placed at any specific place on the screen every time.

So, to renew an extremely old request: could we possibly add a new GEORGE command: tv_SetMouse X Y ?

sven
From the code I've checked, tv_getmouse returns (should return) the position of the cursor WITHIN the picture, which is quite different from the coordinates you can see in the infobar, at the bottom left :
Capture d’écran_2021-06-10_15-23-15.png


If I properly understood your request, this is not what you need. You'd rather need two new George functions :
  • tv_GetScreenPosition would return the position of the mouse in the screen
  • tv_SetScreenPosition sets the cursor position in the screen
Do you agree ?
Thanks for taking another look at this Xavier...

well, there are currently several commands that sort of return X,Y for the cursor location:
tv_WaitButton returns the LMB or RMB down and up plus the X,Y and I have used this for some user input in the past.
tv_GetMouse returns absolute X,Y (I think) for cursor location

Ideally, I think tv_GetScreenPosition and tv_SetScreenPosition would do exactly what I hoped, let the script place the "last" X,Y for the purpose of placing any of the following requests, not just for lists???

tv_listrequest "iEntries1|iEntries2|...|iEntriesn"
tv_reqnum iValue iMin iMax iTitle
tv_reqangle iValue iMin iMax iTitle
tv_reqfloat iValue iMin iMax iTitle
tv_reqstring ["multiline"] ["iTitle|iValue"]
tv_request "iText|[iYes|[iNo]]"
tv_warn iText

And while I'm wish listing here, another very useful user input option would be a check list where the script could show a stack of parameters where boxes could be checked and unchecked AND/OR new values could be entered, for multiple parameter/variables BEFORE closing the list. Now, that would be useful in all kinds of ways - and I would imagine be too complicated to do... in all kinds of ways! :?

Again, really appreciate this!
sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Xavier
Posts: 1855
Joined: 01 Oct 2019, 11:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Xavier »

I'm afraid that in the TVPaint code we don't have any function, that would be able to SET the mouse cursor position. I'll have to implement it for every systems, it will take time to test and so on, so it probably won't be in the 11.5.2 either, sorry.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: tv_GetMouse, is there a tv_SetMouse X Y ?

Post by Svengali »

Of course. You must already have a discouragingly long TODO list each day. Thanks anyway.
Maybe I can improvise something in GEORGE.

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Post Reply