Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST etc)
Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST etc)
Hi all
How can one add to the Scrollbar popup/context menu in (BROWSE, MULTILINE, PICKLIST etc)
Joe
How can one add to the Scrollbar popup/context menu in (BROWSE, MULTILINE, PICKLIST etc)
Joe
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
A DCBROWSE (a XbpBrowse) has a "oVScroll" object for the vertical and a "oHscroll" object for the vertical scrollbar. Unfortunately, those are protected, so you can't access them like this:
You need to traverse the childlist of your browse object and look for scrollbars (IF oBrowse:ChildList():IsDerivedFrom('XbpScrollbar') .and. oBrowse:ChildList():type == XBPSCROLL_HORIZONTAL -> this is the horizontal scrollbar of the browse), maybe in the EVAL clause of DCREAD (DCREAD ... EVAL {||FindScrollBars(oBrowse)}). After that, you can place any code you want in the RbClick (or any other) slot. It's easier to do something like this in a custom handler You may create a menu using the DCMENU commands and do something like this:
This is untested code, written here directly. There maybe errors/typos in it.
Code: Select all
* won't work:
@ 0,0 DCBROWSE oBrowse ... EVAL {|o|oHScroll:LbClick := {||MsgBox('Right click in horizontal scrollbar')}}
Code: Select all
DCSUBMENU oContextMenu // create as a PRIVATE, so the handler can access it, otherwise create a HANDLERBLOCK
DCMENUITEM 'Test' PARENT oContextMenu ACTION {||MsgBox('Popup menu for horizontal scrollbar')}
Code: Select all
DCREAD ... HANDLER MyContextHandler REFERENCE oBrowse
...
STATIC FUNCTION MyContextHandler(nEvent,mp1,mp2,oXbp,oDialog,GetList,oBrowse)
LOCAL i
IF nEvent == xbeM_RbDown .AND: oXbp:IsDerivedFrom('XbpScrollBar') .and. oXbp:type == XBPSCROLL_HORIZONTAL .and. oXbp:SetParent()==oBrowse // must be the horiz. scrollb. of the browse
oContextMenu:Popup(Xbp,mp1)
ENDIF
...
RETURN DCGUI_NONE
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
Hi Tom
Your suggestion worked as expected. It appear the default context menu is overloaded by my custom menu. With this, I will just implement the default menu items namely:
Scroll Here
Top
Bottom
Page Up
Page Down
Scroll Up
Scroll Down
and then add my own menu items.
Thanks
Your suggestion worked as expected. It appear the default context menu is overloaded by my custom menu. With this, I will just implement the default menu items namely:
Scroll Here
Top
Bottom
Page Up
Page Down
Scroll Up
Scroll Down
and then add my own menu items.
Thanks
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
A pleasure.Thanks

If you use a handlerblock instead of the HANDLER clause, you can make the menu LOCAL and hand it to the handler function in the codeblock.
Ooops. I wasn't aware that there is a contect menu in a scrollbar.It appear the default context menu is overloaded by my custom menu.

A better choice would be additional buttons like this (see picture). Hard to implement, since XbpScrollbars are system controls and change their appearance by system settings.
- Attachments
-
- scrollbuttons.jpg (4.08 KiB) Viewed 11994 times
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
Addition: You can write one single handler function used in any DCREAD.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
What context menu? I don't get one.Ooops. I wasn't aware that there is a contect menu in a scrollbar
The eXpress train is coming - and it has more cars.
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
Right click with a mouse in a scrollbar connected to a browse:
- Attachments
-
- rightclickbrowse.jpg (14.29 KiB) Viewed 11977 times
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
I tried that. I get nothing.
Maybe it needs to be enabled in some way.
Maybe it needs to be enabled in some way.
The eXpress train is coming - and it has more cars.
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
Hi,
I also have that context menu. Never seen it before, but it is there.
Looks as Puge UP/Down are working, go Top or Bottom are not working.
I don't think that any of my isers ever tried this. It is not important for my application.
I also have that context menu. Never seen it before, but it is there.
Looks as Puge UP/Down are working, go Top or Bottom are not working.
I don't think that any of my isers ever tried this. It is not important for my application.
Re: Scrollbar context menu in (BROWSE, MULTILINE, PICKLIST e
Hi all
I am aware that some of those menu items are not working but that is not my problem. I am not a low level guy but it appear that even in other programming languages, they are not working too. May be it is a Windows OS bug. Now with what Tom shown me, I may be able to achieve my objectives. In our application, each user has a profile. When a user log in on a work station, the application will load according to his/her saved profile. One of the things we are contemplating is ability of individual user to change the presentation parameter of browse for example at runtime and save it to his profile so that which ever workstation he logs on to, the presentation will be displaced there and so on...
Joe
I am aware that some of those menu items are not working but that is not my problem. I am not a low level guy but it appear that even in other programming languages, they are not working too. May be it is a Windows OS bug. Now with what Tom shown me, I may be able to achieve my objectives. In our application, each user has a profile. When a user log in on a work station, the application will load according to his/her saved profile. One of the things we are contemplating is ability of individual user to change the presentation parameter of browse for example at runtime and save it to his profile so that which ever workstation he logs on to, the presentation will be displaced there and so on...
Joe