Guys
Can you advise on how to introduced scrolling the GRID by mouse wheel events in the Grid example distributed with v8.+. I have scoured the forum with no luck.
Thanks in advance
Dave Plummer
-
- VIP Member
- Posts: 81
- Joined: 18 Jul 2006 17:18
Wheel Scrolling in Grid Example
Dave Plummer
-
- VIP Member
- Posts: 81
- Joined: 18 Jul 2006 17:18
Re: Wheel Scrolling in Grid Example
OK, if interested, I got it.
1) move the declaration of "grid_vmove_cells_area" to vpiGrid.cl
2) Add listener " addVScrollListener(onVScroll)" to the clause " generatedInitialize()" in childDialog.pro
3) add the clause "onVScroll" to handle the scroll event
1) move the declaration of "grid_vmove_cells_area" to vpiGrid.cl
2) Add listener " addVScrollListener(onVScroll)" to the clause " generatedInitialize()" in childDialog.pro
3) add the clause "onVScroll" to handle the scroll event
Code: Select all
onVScroll(Source, ScrollCode, ThumbPosition) -
if ScrollCode = 2 then
vpiGridgrid_vmove_cells_area(activeGrid, 1)
elseif ScrollCode= 1 then
vpiGridgrid_vmove_cells_area(activeGrid, -1)
end if,
!.
Dave Plummer
-
- VIP Member
- Posts: 452
- Joined: 5 Nov 2000 0:01
Re: Wheel Scrolling in Grid Example
Dave,
Should vpiGridgrid_vmove_cells_area be vpiGrid::grid_vmove_cells_area ?
Add listener " addVScrollListener(onVScroll)" confuses me. Do you mean add a VScroll listener (onVScroll) ?
Also, where is activeGrid defined? I can't find it.
Thanks for digging into this. I hope your tweaks get added into the next VP update.
Should vpiGridgrid_vmove_cells_area be vpiGrid::grid_vmove_cells_area ?
Add listener " addVScrollListener(onVScroll)" confuses me. Do you mean add a VScroll listener (onVScroll) ?
Also, where is activeGrid defined? I can't find it.
Thanks for digging into this. I hope your tweaks get added into the next VP update.
- Thomas Linder Puls
- VIP Member
- Posts: 1424
- Joined: 28 Feb 2000 0:01
Re: Wheel Scrolling in Grid Example
I don't have any really good information about this, but I have a warning.
Don't make any changes in generatedInitialize it is generated (as the name and the surrounding comments implies).
Whatever you like to do in generatedInitialize do it in the constructor after the call to generatedInitialize instead.
Don't make any changes in generatedInitialize it is generated (as the name and the surrounding comments implies).
Whatever you like to do in generatedInitialize do it in the constructor after the call to generatedInitialize instead.
Regards Thomas Linder Puls
PDC
PDC
-
- VIP Member
- Posts: 81
- Joined: 18 Jul 2006 17:18
Re: Wheel Scrolling in Grid Example
Guys
No changes to generatedInitialize .
Let me restate the steps:
1) move the declaration of "grid_vmove_cells_area" to vpiGrid.cl
2) Add listener " addVScrollListener(onVScroll)]" to the constructor new(Parent) in childDialog.pro
the name "onVScroll" is arbitary, and will be the name of predicate called on vscroll event.
3) modify the onShow clause in childDialog.pro in order to add the GridWindow to database
first, add the fact section
then the modified onShow
4) and lastly the onVscroll clause
I hope that explains it better.
Dave
No changes to generatedInitialize .
Let me restate the steps:
1) move the declaration of "grid_vmove_cells_area" to vpiGrid.cl
2) Add listener " addVScrollListener(onVScroll)]" to the constructor new(Parent) in childDialog.pro
Code: Select all
new(Parent) :-
dialog::new(Parent),
generatedInitialize(),
This:addVScrollListener(onVScroll),
3) modify the onShow clause in childDialog.pro in order to add the GridWindow to database
first, add the fact section
Code: Select all
facts
activeGrid : vpiDomains::windowHandle := erroneous.
Code: Select all
onShow(Source, _Data) :-
!,
get_init_grid_conf(caller, GridStyle, RowStyle, ColumnStyle),
WinDef = [customctl(wdef(wc_Custom, rct(1, 1, 440, 249), "Custom", u_DlgBase), "grid", 40000, [wsf_Group, wsf_TabStop])],
GridWin = vpi::winCreateDynControl(WinDef, Source:getVpiWindow()),
activeGrid := GridWin,
vpiGrid::init(GridWin, GridStyle, RowStyle, ColumnStyle, grid_callback),
vpiGrid::visitorder(GridWin, 90, c_Alt, vpiGrid::grid_right).
Code: Select all
predicates
onVScroll : window::scrollListener.
clauses
onVScroll(_Source, ScrollCode, _ThumbPosition) :-
if ScrollCode = 2 then
vpiGrid::grid_vmove_cells_area(activeGrid, 1)
elseif ScrollCode = 1 then
vpiGrid::grid_vmove_cells_area(activeGrid, -1)
else
succeed
end if,
!.
Dave
Dave Plummer
Re: Wheel Scrolling in Grid Example
Please tell me if you have working code to go to the next cell? I need behavior to be Excel like
This code doesn't work
Code: Select all
vpiGrid::visitorder(GridWin, 90, c_Alt, vpiGrid::grid_right).
Code: Select all
init(GridWin, CellsStyle, CellsRowStyle, CellsColumnStyle, CallBackFunc) :-
grid_remove_markers(GridWin, grid_single_marker),
grid_get_param(GridWin, CellsStyle, CellsRowStyle, CellsColumnStyle),
assert(grid_info(GridWin, RCT, CallBackFunc, ParentWin)),
…..
assert(grid_visit_order(GridWin, grid_key_enter, c_Nothing, grid_down)),
assert(grid_visit_order(GridWin, grid_key_enter, c_Shift, grid_up)),
assert(grid_visit_order(GridWin, grid_key_tab, c_Nothing, grid_right)),
assert(grid_visit_order(GridWin, grid_key_tab, c_Shift, grid_left)),
assert(grid_visit_order(GridWin, grid_max_length, c_Nothing, grid_right)),