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 calc Hscroller with tabs correctly?

Featured Replies

Posted

Hi guys,

so I have a question about using / calculate / handling a HSCROLL control.So I would like to create a HSCROLL control what gets set and moved correctly and nice dependent on a tab control (X tabs = dynamic).Problem is I dont get it really good working.

Lets say I have only one tab so then the thumbtrack should take the entire place in the hscroller and if I add more tabs then it should get smaller and smaller etc like in Notepad app for example.Next problem are the positions to set them correctly + calculate the right value to adjust everything you know.I made a example for testing.Maybe you can check this.

		invoke GetDlgItem,hWnd,IDC_HSCROLL
		mov HS_HANDLE, eax
		mov SINFO.cbSize, sizeof SINFO
		mov SINFO.fMask, SIF_ALL
		mov SINFO.nMin, 0
		mov SINFO.nMax, 100
		mov SINFO.nPage, 10
		invoke SetScrollInfo,HS_HANDLE,SB_CTL,addr SINFO,TRUE 





	.elseif uMsg == WM_HSCROLL
	          invoke GetDlgItem,hWnd,IDC_HSCROLL
	          .if lParam == eax
	              mov edi, wParam
	              LOWORD wParam
	              mov edi, eax
	              HIWORD wParam
	              .if edi==SB_LINELEFT || edi==SB_PAGELEFT || edi==SB_THUMBTRACK && eax < 50
	                            invoke SetScrollPos,HS_HANDLE,SB_CTL,eax,FALSE
	                            invoke SendMessage,TABHANDLE,TCM_GETITEMCOUNT,0,0
	                            .if eax!=0
	                                mov esi,eax
	                                invoke SendMessage,TABHANDLE,TCM_GETCURSEL,0,0
	                                .if eax!=-1h || eax!=0h
	                                    mov edi, eax
	                                    sub edi, 1h
	                                    .if edi==0h || edi < esi
	                                    invoke SendMessage,TABHANDLE,TCM_SETCURSEL,edi,0
	                                    invoke SendMessage,TABHANDLE,TCM_GETCURSEL,0,0
	                                    mov tabIndex, edi	                                    
	                                    .endif
	                                .endif
	                            .endif	                  
	             .elseif edi==SB_LINERIGHT || edi==SB_PAGERIGHT || edi==SB_THUMBTRACK && eax > 50
	                            invoke SetScrollPos,HS_HANDLE,SB_CTL,eax,FALSE
	                            invoke SendMessage,TABHANDLE,TCM_GETITEMCOUNT,0,0
	                            .if eax!=0
	                                mov esi,eax
	                                invoke SendMessage,TABHANDLE,TCM_GETCURSEL,0,0
	                                .if eax!=-1h || eax!=0h
	                                    mov edi, eax
	                                    add edi, 1h
	                                    .if edi==0h || edi < esi
	                                    invoke SendMessage,TABHANDLE,TCM_SETCURSEL,edi,0
	                                    invoke SendMessage,TABHANDLE,TCM_GETCURSEL,0,0
	                                    mov tabIndex, edi 
	                                    .endif
	                                .endif
	                            .endif	 	             
	           .endif
	      .endif

HScroller.rar

Thank you

  • Author

Hi Ted,

yes I have seen this too already.The problem I got is again some calculations as always.So yesterday I got something working after long testing and the scroller gets adjusted and updated correctly with the lenght of the tabs (dynamicly) so thats good now so far.Just need to update the nMax parameter.Now its working good but not so perfect like the scroller from notepad or Listviews itself.I mean if I move the thumbtrack very quick from one side to the other then it will mostly not reach the first or last tab.No idea why its so.If I scroll a bit slower then all is working good.A other problem what I have is that I cant calc / set the thunbtrack lenght anyhow so my is always same also if I add or remove tabs.Somehow I have to set the nPage for this but dont get it working correctly.I attach my latest test which works good so far so I think with that result I can live so far.Just test it but remember if you are moving the scroller too quick then it stops mostly somewhere before and sroller jumps back same with tab position.Maybe the scrollbar is too small for this or something no idea.

HScroller2.rar

greetz

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.