#1 2017-05-17 02:32:56

reg4app
Member
Registered: 2016-05-16
Posts: 147

can the menu move along with the mouse scroll down the view?

In Sample FixedContainer ,I attach a menu to the button (The Button is in the Container on the top of view,just like the Sample Menu2),
After click the button ,the menu popup up,but how can i move the menu while the view is scrolling down??just as the Buttons do?


Joshua.Y

Offline

#2 2017-05-17 07:39:54

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: can the menu move along with the mouse scroll down the view?

Hello Joshua,

What about to use a Dropdown or Select controls instead a Menu one? Anyway, right now we have no "scroll" events, but we can use "pure" Javascript to attach some app's function to some possible "scroll" event of the app's view. Take a look a this article and please tell me if you have any further questions.

Offline

#3 2017-05-17 09:13:29

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: can the menu move along with the mouse scroll down the view?

Use Dropdown,the popup menu still not follow with the Dropdown Button while view scrolling down

and to the article
you mean:Menu2.onscroll = function(){myScript};??


Joshua.Y

Offline

#4 2017-05-17 09:23:09

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: can the menu move along with the mouse scroll down the view?

Hello Joshua,

Certainly something like the below (placed in the view's Show event) do not work as expected:

StartJS
  window.document.getElementById('View1').addEventListener('scroll', function() {
    alert('scroll');
  });
EndJS

Can you provide here a little app sample sir? Maybe with a bit of CSS we can get the menu acting like you wanted.

Offline

#5 2017-05-17 10:10:23

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: can the menu move along with the mouse scroll down the view?

in View1 showevent

StartJS
window.onscroll = function() {window.App.Scope.scroll_set_popmenu_position();};
EndJS

And I create a Function in ABscript name 'scroll_set_popmenu_position'

GetStyle "Button1" "top" "[ButtonTop]"
GetStyle "Button1" "left" "[ButtonLeft]"

SetStyle "Menu1" "top" "[ButtonTop]"
SetStyle "Menu1" "left" "[ButtonLeft]"

This seems the fuction will be called while 'Scrolling',but the menu position is not right!
neutral and neutral


Joshua.Y

Offline

#6 2017-05-17 10:23:03

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: can the menu move along with the mouse scroll down the view?

Hello Joshua,

I am not sure if attach an "scroll" event to the "window" can be good here. Anyway, can you see what "[ButtonTop]" and "[ButtonLeft]" store? When the menu is shown? When is hide? Honestly I can't figure out exactly what you wanted, I am sorry for that.

Can you please provide here a little app sample so we can take a look?

Offline

#7 2017-05-17 13:26:10

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: can the menu move along with the mouse scroll down the view?

in fact ,all I want to say is that:
In Sample FixedContainer,if I popup a menu by click the button(or use  Dropdown Button)
while the popup menu still visible ,
and I do 'MouseDown' action,the popumenu does not follow the button move downforward


Joshua.Y

Offline

#8 2017-05-17 13:42:25

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: can the menu move along with the mouse scroll down the view?

Hello Joshua,

Thanks. Finally I think I got it. Please, loot at the below attached sample:

FixedContainer.ab

Press the first top button and you can see a Menu. Scroll down the app's view and now the Menu continues there. The "trick" is made by set the "position = fixed" to the Menu, as you can see in the sample's "Inline CSS" option. Hope this can help you in some way.

P.S. Anyway, consider to use an entire view for menus. Some menus can be implemented like that and for sure its a good way to do it, showing the "menu" view as a dialog or not.

Offline

#9 2017-05-17 14:08:53

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: can the menu move along with the mouse scroll down the view?

Oh,this work! smile
I know the 'entire View for menus',but i want to try some different ways

and will this 'position = fixed' will work with  Dropdown Button's menu too?


Joshua.Y

Offline

#10 2017-05-17 14:16:45

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: can the menu move along with the mouse scroll down the view?

Hello Joshua,

Yes; apparently the same "trick" can be used with a DropDown button in the same scenario. Take a look at the below sample:

FixedMenu.ab

However, this time we set the "position = fixed" to certain CSS class... and maybe this can interfere in some others DropDown controls.

Offline

#11 2017-05-17 14:36:13

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: can the menu move along with the mouse scroll down the view?

excellent!Thanks you very much!


Joshua.Y

Offline

#12 2017-05-17 14:37:59

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: can the menu move along with the mouse scroll down the view?

reg4app wrote:

excellent!Thanks you very much!

You're welcome sir! smile

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.