Media Companion
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Media Companion

Discussion and development board for the program Media Companion.
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

 Mouse Wheel enabled for the poster wall?

Go down 
3 posters
AuthorMessage
paybac
Media Companion Supporter
Media Companion Supporter
paybac


Posts : 155
Join date : 2009-08-31
Location : New Zealand

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeMon Nov 23, 2009 2:39 am

Possible to get the mouse wheel enabled for the poster wall?
Back to top Go down
billyad2000
Admin
billyad2000


Posts : 1326
Join date : 2008-09-20

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeFri Nov 27, 2009 2:45 pm

Yes, but for some reason I will have to disable it while the wall is being populated.

If anyone knows why the following is happening then I would appreciate any help.

When the vertical scroll of the wall is altered then the location of the where the picbox is placed is changed, the workaround is to subtract the scrollbar position eg,
Code:
 Dim vscrollPos As Integer = TabPage22.VerticalScroll.Value
 .Location = New Point(locx, locy - vscrollPos)
This works great when the scrollbar is moved via the left mouse drag, all the images are placed properly.

The mouse wheel event is attached to the tabcontrol and not the tabpage, so I capture it via the tabcontrol mousewheel event, i.e.
Code:
            If TabControl2.SelectedIndex = 1 Then
                Try
                    TabPage22.VerticalScroll.Value -= e.Delta
                Catch
                    'out of bounds
                End Try
            End If
The problem is that with this, when the scrollbar is moved with the mousewheel, for some reason the vertical placement of the images is messed up badly, with rows missed and images overlapping. The only workaround I can think of is to disable it until the wall has been completely populated.
Back to top Go down
http://billyad2000.co.uk
StormyKnight
VIP
VIP



Posts : 556
Join date : 2008-10-08
Location : Australia

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeSat Nov 28, 2009 2:03 am

Its probably something to do with the fact that the form size is growing. The initial calculation (perhaps internal to the wheelmouse control) works out the scroll bar size initially & does some calculations on that information. As the form grows, those calculations become irrelavent & perhaps results in the display looping around because instead of being one screen height it now may be 7 or 8 pages high.

In saying that it is only a theory....

You may need to refresh the information at the creation of each new line or something like that, so it is kept up to date with the real size of the form.


OR it may be that your e.Delta line should be like this...

int move = e.Delta * SystemInformation.MouseWheelScrollLines / 120;

From this website...

http://bytes.com/topic/c-sharp/answers/558346-scrollbar-mystery

Quote :
When handling the MouseWheel event it is important to follow the user interface (UI) standards associated with the mouse wheel. The MouseEventArgs.Delta property value indicates the amount the mouse wheel has been moved. The UI should scroll when the accumulated delta is plus or minus 120. The UI should scroll the number of logical lines returned by the SystemInformation.MouseWheelScrollLines property for every delta value reached. You can also scroll more smoothly in smaller that 120 unit increments, however the ratio should remain constant, that is SystemInformation.MouseWheelScrollLines lines scrolled per 120 delta units of wheel movement.

As explained here... http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousewheel%28VS.71%29.aspx

This web page is also an interesting read re the delta, it points to possible issue with Vista (Win7?)...

http://social.msdn.microsoft.com/Forums/en-US/gametechnologiesgeneral/thread/1deb5f7e-95ee-40ac-84db-58d636f601c7


Thirdly, is it possible to detect mousewheel direction, but then trigger the scroll bars as if the user had pushed the top or bottom scrollbar arrows....

& I have a forth option...

Quickly create the space required to show the number of movies, then activate the mousewheel, then populate.


Cheers
Back to top Go down
billyad2000
Admin
billyad2000


Posts : 1326
Join date : 2008-09-20

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeSun Nov 29, 2009 3:06 pm

Finally got this working, although the situation is very wierd to say the least.

Code:
If TabControl2.SelectedIndex = 1 Then
    mousedelta = e.Delta / 120
    Try
        TabPage22.AutoScrollPosition = New Point(0, TabPage22.VerticalScroll.Value - (mousedelta * 120))
    Catch ex As Exception
    End Try
End If
Works without issue, the images are placed correctly, even when the scroll is used. It does seem a bit strange to divide the delta by 120 only to multiply it by 120 again, eg.
Code:
If TabControl2.SelectedIndex = 1 Then
    mousedelta = e.Delta
    Try
        TabPage22.AutoScrollPosition = New Point(0, TabPage22.VerticalScroll.Value - mousedelta)
    Catch ex As Exception
    End Try
End If
This time, even though the logic is identical, the images become misplaced - can't work out the reason, I love logic except when it is not logical Smile
Back to top Go down
http://billyad2000.co.uk
paybac
Media Companion Supporter
Media Companion Supporter
paybac


Posts : 155
Join date : 2009-08-31
Location : New Zealand

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeSun Nov 29, 2009 10:15 pm

Cheers, thanks Billy

Edit: Wow this works really nicely in 3.175
Back to top Go down
StormyKnight
VIP
VIP



Posts : 556
Join date : 2008-10-08
Location : Australia

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeMon Nov 30, 2009 3:32 am

If mousedelta is an integer what effectively you are doing is rounding the final value to a multiple of 120.......


Code:
e.g e-delta value    /120            final value(int* 120)
 120                    1                          120
 140                    1.166                      120
 160                    1.333                      120
 280                    2.333                      240
 400                    3.333                      360
 700                    5.833                      600
1000                    8.333                      960
1200                  10                          1200



The rounding to 120 is because each scroll line is 120 mouse movement units....Sounds like the form needs to work in whole scroll units to me.

Does this sound like a possibility?

PS I really hate code that works & I don't know why Smile
..its nearly as bad as code that doesn't work & I don't know why! Shocked


Last edited by StormyKnight on Mon Nov 30, 2009 11:32 am; edited 1 time in total
Back to top Go down
StormyKnight
VIP
VIP



Posts : 556
Join date : 2008-10-08
Location : Australia

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeMon Nov 30, 2009 11:28 am

I've just load the new version Billy, & I was just wondering if there would be any way to increase the granuality of the mouse scrolls.....


They seem to be quite large in there incrementation..... I suspect it to be multiplication of the 120 again of the e-delta.


If it is an issue during the creation, then perhaps the current code can be used, but once the form is complete, could the "120" be reduced to smooth the scrolling? If I suspect what is happening in your code & mousedelta is an integer, then making it a float should still allow you code to position the pictures correctly, but also allow smaller steps in the scrolling.


If you go down this track, may I suggest that you incorporate the following information incase it becomes a future issue especially for Vista (Win7?) it seems...

Code:
1) Add up the deltas and wait until you get 120; keep the leftover for next time. (But this will mean the lumpy scrolling as it is now)

2) Use the deltas raw, without /120 - maybe too fine meaning heaps of mouse scrolls to move anywhere...

3) Use floats instead of int math - change the "/120" to adjust smoothness - Recommended!

from http://social.msdn.microsoft.com/Forums/en-US/gametechnologiesgeneral/thread/1deb5f7e-95ee-40ac-84db-58d636f601c7

Cheers
Back to top Go down
billyad2000
Admin
billyad2000


Posts : 1326
Join date : 2008-09-20

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeMon Nov 30, 2009 1:25 pm

StormyKnight wrote:
If mousedelta is an integer what effectively you are doing is rounding the final value to a multiple of 120.......


Code:
e.g e-delta value    /120            final value(int* 120)
 120                    1                          120
 140                    1.166                      120
 160                    1.333                      120
 280                    2.333                      240
 400                    3.333                      360
 700                    5.833                      600
1000                    8.333                      960
1200                  10                          1200



The rounding to 120 is because each scroll line is 120 mouse movement units....Sounds like the form needs to work in whole scroll units to me.

Does this sound like a possibility?

PS I really hate code that works & I don't know why Smile
..its nearly as bad as code that doesn't work & I don't know why! Shocked

Thats what I first thought, but on collecting the e.delta value it is always in multiples of 120 anyway.
Back to top Go down
http://billyad2000.co.uk
billyad2000
Admin
billyad2000


Posts : 1326
Join date : 2008-09-20

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeMon Nov 30, 2009 1:32 pm

StormyKnight wrote:
I've just load the new version Billy, & I was just wondering if there would be any way to increase the granuality of the mouse scrolls.....


They seem to be quite large in there incrementation..... I suspect it to be multiplication of the 120 again of the e-delta.


If it is an issue during the creation, then perhaps the current code can be used, but once the form is complete, could the "120" be reduced to smooth the scrolling? If I suspect what is happening in your code & mousedelta is an integer, then making it a float should still allow you code to position the pictures correctly, but also allow smaller steps in the scrolling.


If you go down this track, may I suggest that you incorporate the following information incase it becomes a future issue especially for Vista (Win7?) it seems...

Code:
1) Add up the deltas and wait until you get 120; keep the leftover for next time. (But this will mean the lumpy scrolling as it is now)

2) Use the deltas raw, without /120 - maybe too fine meaning heaps of mouse scrolls to move anywhere...

3) Use floats instead of int math - change the "/120" to adjust smoothness - Recommended!

from http://social.msdn.microsoft.com/Forums/en-US/gametechnologiesgeneral/thread/1deb5f7e-95ee-40ac-84db-58d636f601c7

Cheers

120 is just the default setting. You will find that any program will scroll a similar ammount on a mouse wheel notch. It is also what MS recommends to keep things in sync.
Reducing it to 60 does make for a smoother scroll, but with a lot of movies it would take much longer to scroll through them.

Not multiplying would mean that the control scrolls one pixel per notch on the mousewheel, i tested it and while 100% smooth, for practical purposes it is useless
Back to top Go down
http://billyad2000.co.uk
StormyKnight
VIP
VIP



Posts : 556
Join date : 2008-10-08
Location : Australia

Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitimeMon Nov 30, 2009 1:48 pm

Interesting....

As an example, I use the mouse wheel to scroll in Firefox, it seems that it is quite smooth, but I think its artificially created....

Its like instead of jumping 120 units, it moves thru perhaps 5, 10, 15, 20...115,120 with the required delay between each step, thus simulating a smooth scroll.... Maybe thats how they do it.....This would eliminate the jumping effect which makes viewing difficult whilst scrolling.

Cheers Smile
Back to top Go down
Sponsored content





Mouse Wheel enabled for the poster wall? Empty
PostSubject: Re: Mouse Wheel enabled for the poster wall?   Mouse Wheel enabled for the poster wall? Icon_minitime

Back to top Go down
 
Mouse Wheel enabled for the poster wall?
Back to top 
Page 1 of 1
 Similar topics
-
» Option to disable poster resize on mouse over.
» 3.175 Change Poster From Wall
» 3.168 - After selecting movie poster 'sometimes' end up on Wall
» MC 3.175 Mouse Over / Run Time
» v2.079 Please fix WALL-E....[WALL·E]

Permissions in this forum:You cannot reply to topics in this forum
Media Companion :: Media Companion :: Feature Requests-
Jump to: