Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to set a slider control position by mouseclick?

Featured Replies

Posted

Hi again,

got a new problem again where I need some help.I created a sliderbar control and wanna change the position by mouseclick exactly where I do press with the mouse.I did subclass the slider control and do catch at WM_LBUTTONDOWN message and wrote my code so far...

.if uMsg == WM_LBUTTONDOWN
	        LOWORD lParam
	        mov pt.x,eax
	        mov ISH, eax ; <----
	        HIWORD lParam
	        mov pt.y,eax
	        nop

	    invoke SendMessage,SLIDERHANDLE,TBM_GETCHANNELRECT,0,addr CHANNELRECT
            push CHANNELRECT.right
            pop eax
            push CHANNELRECT.bottom
            pop ecx
            push CHANNELRECT.left ; x
            pop edi
            push CHANNELRECT.top  ; y
            pop esi
            sub eax,edi
            sub ecx, esi	        
            mov edx, CHANNELRECT.left
            mov ebx, CHANNELRECT.top	        
	        

	        mov FULL_LENGHT, eax

	        mov eax, ISH ; current
	        mov ecx, 64h
	        mov edx, 0h
	        mul ecx
	        mov ecx, FULL_LENGHT ; full length
	        mov edx, 0
	        div ecx
	        invoke SendMessage,hWnd,TBM_SETPOS,TRUE,eax

...so its also working good so far but the small problem I have is that the slider will not set exactly at the position where I press with the mouse so its some mm more right at the beginning and gets less at the end so at the end its correctly etc you know what I mean.So have I to calc else or so?My slider maxrange is set to 100.Anyway,so I come not clear again with that calculations so maybe you can help again a little.On the net I found a Delphi example what does div by 2 anyhow etc.

http://www.delphipraxis.net/107882-beim-klick-auf-eine-trackbar-zur-klickposition-springen.html

Thanks

  • Author

Hi,

I have another question.Does anyone know how to set a window smaller than the client itself?Same as in your videoplayer like VLC.Just imagine you start playing a 16:9 video and now you wanna cut the view to 4:3 format (left & right side get cut of video).Problem now is how to handle that.So I have set the clientwindow (videowindow) same to player window at WM_SIZE so that the video does move with the app window if I change it.So I am getting totaly confused so maybe you can help a little.

Thanks

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.