|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Questions regarding MouseDrag and MouseClick Listeners
I've been working with the MouseDrag and MouseClick listeners and I've run into a snag. I need to get the relative cursor position on screen with respect to the whole sage UI, not just relative to the UI component in which the mouse click occured. According to the Studio Manual (pg.58), it appears as if X and Y should give the cursor location in pixels relative to the whole UI, however it too appears to be relative to the clicked UI component.
I also tried calling sage_UIManager_getCursorPosX(), but that returns the pixel location with respect to the entire screen, not just the Sage UI when windowed. So I'm in a bind here. Is there any way to get the cursor location with respect to just the SageUI window? I can calculate the relative position from there. Any thoughts? Thanks! Aloha, Mike Edit: Now that I think about it, sage_UIManager_getCursorPosX() should still let me do what I want, since I'm going to subtract off the initial position anyway. But I'd still like to know if there is a better solution.
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) Last edited by MeInMaui; 06-10-2009 at 05:43 PM. |
#2
|
||||
|
||||
First, the sage_UIManager_getCursorPosX() & sage_UIManager_getCursorPosY() calls return coords relative to the top left corner of the primary monitor, not the SageTV UI, so I need to update those Studio docs.
So, to get the x,y mouse coords within the SageTV window, you would need to find the position of the SageTV windows and adjust the above results. There are no SageTV calls for this, but you can use java.awt calls to get it - if you really need this & want more info, I think I have some STV code laying around somewhere I can look up. And, the X & Y coords from the mouse listeners are relative to the UI component, so I also need to clarify that in the Studio docs since it only mentioned it for RelativeX & RelativeY. - Andy
__________________
SageTV Open Source v9 is available. - Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1. - Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus - HD Extenders: A) FAQs B) URC MX-700 remote setup Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request. |
#3
|
||||
|
||||
Thanks for the info Andy.
I was able to do what I needed using the sage_UIManager_getCursorPosX() & sage_UIManager_getCursorPosY() calls. I'm only interested in the differential position from the initial click (just like RelativeX and RelativeY, but wrt the whole UI), so I was able to record the initial position, calculate the differential X and Y positions, and then scale by GetFullUIHeight() and GetFullUIWidth(). It's a little choppier than I'd like, but it gets the job done. Maybe I'll put in a feature request for a set of X, Y, RelativeX, and RelativeY local variables that reference the full sage UI. It sure would make things easier and probably quite a bit faster. Thanks again! Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#4
|
||||
|
||||
Quote:
It turns out that I do have need to get the x,y coords within the SageTV window. If you get the chance, I would really appreciate it if you dig up that STV code you mentioned. It isn't a big deal if you don't have time or can't find it. I'll start looking into it on my own in the meantime. Thanks! Aloha, Mike Edit: I'm guessing that I'll have to use something like java_awt_Component_getLocationOnScreen(). I assume I have to pass it some kind of handle for the UI window, which I don't know.
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) Last edited by MeInMaui; 06-29-2009 at 04:24 PM. |
#5
|
||||
|
||||
I looked some old STV code I had... and here's how to get the window frame:
Code:
WindowFrame = javax_swing_SwingUtilities_getAncestorOfClass(java_lang_Class_forName("java.awt.Frame"), GetEmbeddedPanel()) Code:
CurX = java_awt_Frame_getX(WindowFrame) CurY = java_awt_Frame_getY(WindowFrame) I believe the window's position includes the title bar & frame, so there may still be an issue getting the position in the UI area. It looks like java_awt_Frame_getInsets() got the visible frame size, but not the height of the title bar... and it seemed messy to use getSize() to get the size of the window, then adjust the height for the bottom inset & GetFullUIHeight() to find the title bar height. Of course, full screen mode shouldn't have any edges to be adjusted. - Andy
__________________
SageTV Open Source v9 is available. - Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1. - Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus - HD Extenders: A) FAQs B) URC MX-700 remote setup Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request. |
#6
|
||||
|
||||
Thanks Andy!
That was exactly what I needed. Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
TV questions | jayrbrown77 | Hardware Support | 6 | 10-12-2006 08:00 PM |
A Few Questions | deadtoaster2 | General Discussion | 7 | 06-30-2005 07:00 PM |
Questions regarding 2.2.3 | srcurtis | SageTV Beta Test Software | 0 | 01-22-2005 01:51 PM |
TV-out questions | ToonGal | Hardware Support | 7 | 04-24-2004 08:29 PM |