SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-04-2007, 12:02 PM
travisbell travisbell is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 171
Draw image on mouse rollover?

Hey guys,

What is the easiest way to draw a new image when you mouse over a menu item?

I am looking at adding some icons to the main menu but I can't seem to get the code quite right.

Thanks,
__________________
--
Travis Bell
Consumeroo
iSage Theme
Reply With Quote
  #2  
Old 03-04-2007, 12:14 PM
MeInMaui's Avatar
MeInMaui MeInMaui is offline
SageTVaholic
 
Join Date: Feb 2005
Location: Maui. HI
Posts: 4,203
Quote:
Originally Posted by travisbell
Hey guys,

What is the easiest way to draw a new image when you mouse over a menu item?

I am looking at adding some icons to the main menu but I can't seem to get the code quite right.

Thanks,
I think the simplest way is to set a boolean variable like EnableRolloverImage to true in a FocusGained() hook and false in a FocusLost() hook (make sure to call RefreshArea(menu panel) after the change). Then use a conditional in the UI chain to choose the appropriate graphic. I've been playing a lot with mouseover effects lately. HTH

Aloha,
Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full."
- Nikolaus (4yrs old)
Reply With Quote
  #3  
Old 03-04-2007, 12:38 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
And in addition to what Mike said, you can also just use
Code:
- If Focused
  +- true
      +- Image1
  +- false
      +- Image2
And as another alternative, you can use a button theme and specify different images for "Background Image" and "Background Selected Image"


Dirk
Reply With Quote
  #4  
Old 03-04-2007, 12:54 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Or even easier if you want to display the image 'outside' of the menu item, with no need for manual focus detection or refreshing:... in each main menu Item widget have an attribute 'IconPath' with the path to the image, and use GetFocusContext() elsewhere to retrieve the icon path of the currently selected Menu item, and display the image. Refreshing is done automagically when focus changes

(my dynamic menus do something similar to this, as do any of the recordings/schedule menus)

Code:
GetFocusContext()
+-LoadImage(IconPath)
   +-IMAGE
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 03-04-2007 at 01:08 PM.
Reply With Quote
  #5  
Old 03-04-2007, 01:14 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
It depends on what you're trying to do. If you want an image to appear in an item when it has focus, use Dirk's solution. If you want an image to appear in a fixed place on the screen, but the image changes depending on which item has focus, use Neil's solution.

Note that all these suggestions assume that you have "Focus follows mouse movement" enabled in the Customize section of Detailed Setup. It's enabled by default (if I recall correctly) but be aware that these solutions don't detect mouseover per se, but rather the change of focus that (normally) follows the mouse.
__________________
-- Greg
Reply With Quote
  #6  
Old 03-04-2007, 01:49 PM
MeInMaui's Avatar
MeInMaui MeInMaui is offline
SageTVaholic
 
Join Date: Feb 2005
Location: Maui. HI
Posts: 4,203
Quote:
Originally Posted by GKusnick
It depends on what you're trying to do. If you want an image to appear in an item when it has focus, use Dirk's solution. If you want an image to appear in a fixed place on the screen, but the image changes depending on which item has focus, use Neil's solution.

Note that all these suggestions assume that you have "Focus follows mouse movement" enabled in the Customize section of Detailed Setup. It's enabled by default (if I recall correctly) but be aware that these solutions don't detect mouseover per se, but rather the change of focus that (normally) follows the mouse.
One thing I've noticed with the 'If Focused' approach that Dirk mentioned is that it seems to allow for a noticable delay after focus is gained until the change takes effect. That is why I recommended the hooks. The response seems to be instantaneous with this approach. But it is very cool that there are so many approaches available.

Aloha,
Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full."
- Nikolaus (4yrs old)

Last edited by MeInMaui; 03-04-2007 at 02:52 PM.
Reply With Quote
  #7  
Old 03-04-2007, 03:21 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
I can't say I've ever noticed any such delay. Redraw on focus changes seems pretty much instantaneous to me, without the need for explicit Refresh() calls. But that's just my subjective impression.

If you do call Refresh() or RefreshArea() from FocusGained or FocusLost hooks, be sure to Fork() first, as per Note 2 on p.7 of the V6 Studio manual.
__________________
-- Greg
Reply With Quote
  #8  
Old 03-04-2007, 05:48 PM
travisbell travisbell is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 171
Quote:
Originally Posted by nielm
Or even easier if you want to display the image 'outside' of the menu item, with no need for manual focus detection or refreshing:... in each main menu Item widget have an attribute 'IconPath' with the path to the image, and use GetFocusContext() elsewhere to retrieve the icon path of the currently selected Menu item, and display the image. Refreshing is done automagically when focus changes

(my dynamic menus do something similar to this, as do any of the recordings/schedule menus)

Code:
GetFocusContext()
+-LoadImage(IconPath)
   +-IMAGE

Interesting...

I added an attribute to one of my menu items,

Attribute: IconPath
Value: images\menu_1_back.png

But am getting a 'Syntax Error' on the "Value" field...

The rest of it looks like so:

Code:
GetFocusContext()
+-LoadImage(IconPath)
   +-IMAGE
I am not sure what I am doing wrong here...
__________________
--
Travis Bell
Consumeroo
iSage Theme
Reply With Quote
  #9  
Old 03-04-2007, 06:11 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by travisbell
Interesting...

I added an attribute to one of my menu items,

Attribute: IconPath
Value: images\menu_1_back.png

But am getting a 'Syntax Error' on the "Value" field...
Quote it...
and in Strings "\", have to be doubled (as they 'escape' other chars, so value should be:
"images\\menu_1_back.png"
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #10  
Old 03-04-2007, 08:20 PM
travisbell travisbell is offline
Sage Advanced User
 
Join Date: Jan 2005
Posts: 171
Yup. That method works perfectly.

Thanks guys!
__________________
--
Travis Bell
Consumeroo
iSage Theme
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SageMC - Limited Mouse Control? Fountainhead SageMC Custom Interface 1 02-11-2007 03:30 PM
Sage Bug justindd SageTV Linux 5 01-30-2007 10:12 AM
Scaling Text widget size within image widget area Morgan111 SageTV Studio 2 12-04-2006 02:16 PM
Use RC as mouse replacement owilsky Hardware Support 2 12-03-2006 02:41 AM
Any EASY Way to Change The Background Image? joe123 SageTV Customizations 2 01-26-2006 09:23 PM


All times are GMT -6. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.