![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Help with Scroll Bars in Canvas Topic Summary: Created On: 19-Mar-2003 15:51 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||||
Does anyone have an example of a dxl that uses a canvas with scroll bars?
Im having a hard time understanding the agruements that are needed to get the scroll bars to function. Thanks Marc Battistello marc.battistello@pw.utc.com |
|||||
![]() |
|||||
![]() |
|||||
Marc,
I have been having trouble finding information on this as well but here is a function that might help you out!! void scrollCb(DBE canv, ScrollEvent action, ScrollSide which, int newp, int oldp) { if (action == scrollToPos) { scrollSet(canv, which, 100, 10, newp) } else if (action == scrollToHome) { scrollSet(canv, which, 100, 10, 0) } else if (action == scrollToEnd) { scrollSet(canv, which, 100, 10, 100) } } hasScrollbars(canv, scrollCb) Hope this helps!! ><> Natalie Acheson <>< njacheso@rockwellcollins.com |
|||||
![]() |
|||||
![]() |
|||||
This is an old topic, but I did not find anything newer. Anyway, I was working with a canvas DBE lately and wanted to add scrollbars, and after a while I found out that the perms mentioned by the previous poster actually just move the scrollbar, but do nothing at all to the canvas itself, which means you have to repaint the canvas yourself. The latter is a bit tricky, because you have to calculate the offset of the top left corner according to the slider positions and the actual size of your drawing area.
I collected everything I found out in the attached include script (canvas_scrollbar.inc), with which it is quite straightforward to add scrollbars to an existing canvas DBE. See script header for details on how you must update your existing code. Please note that the script and the scrollbars only work if all drawing is done in one canvas callBack routine, therefore e.g. Tony Goodman's Tetris program will not work with scrollbars. The second dxl File (canvas_scrollbar.dxl) is an example on how the scrollbars are used. Have fun, Peter
|
|||||
![]() |
|||||
![]() |
|||||
Hi Peter,
Thats a good script. I am trying to develop something similar, but have noticed that DOORS 8.3 seems to behave differently than 8.1. In 8.1, clicking on the 'down' scroll fires the scroll callback, but in 8.3, it seems to fire it twice, the second time reporting a new position of 0 regardless of the actual scroll position, so you end up losing your scroll. If I run your code on 8.1, its fine, but on 8.3 its not. Paul |
|||||
![]() |
|||||
![]() |
|||||
Hi Paul,
I am still working on 7.1, therefore I can't test the bug you reported. But from what you write I'd guess a workaround would be to replace the line else if (sEvent == scrollDown){} with else if (sEvent == scrollDown){if (newPos <= oldPos){return}} Cheers, Peter |
|||||
![]() |
|||||
![]() |
|||||
Hi Peter,
It turns out that the second scroll callback does not have a standard event type. I put a check in to the start of the scroll function to show what type the event is, it fires twice, the first is a scrollPageDown event, but the second doesn't have an event. You'd think that would solve the problem and you'd be able to just ignore scroll events where the Event type is unknown, but this only stops the canvas from moving, it does not stop the scroll bar from moving back to the starting location. Thanks for your help, but I think this is a bug for Teleogic to deal with. Can anyone tell me if they have tried Peter's script on DOORs 9? Thanks again, Paul |
|||||
![]() |
|||||
![]() |
|||||
After talking to Telelogic, it is an issue with DOORS 8.3 patch 1, but is fixed in DOORS 9.
|
|||||
![]() |
|||||
![]() |
|||||
Paul
I also found the same bug. Have you found a workaround for 8.3? ------------- Gordon Woods BAE Systems (Operations) Limited, Warton, UK gordon.woods2@baesystems.com |
|||||
![]() |
|||||
![]() |
|||||
Hi Gordon,
Sorry, but no. I think it should be possible though. Here's what I found: When the scroll event is a scrollDown or ScrollPageDown on the Vertical scroll bar, the callback is fired twice. The first time is as you'd expect and it returns the new position and old position correctly. The scroll evnt for the first callback is also as you'd expect. However, immediatly after this first calback, there is another one. this second callback has an unknown event type. (Or at least it is not one of the ones documented in the ref manual). However, the fact that this callback doesn't have an event type means you can detect it and ignore it. (So, your scroll function shouldn't do anything if the event type doesn't match one of the event types from the manual - look for hasScrollBars in the DXL reference manual for the event types). This was as far as I got. Needless to say, this isn't a workaround. All it means is that the second scroll event will not move your image on the canvas. The scrollbar still jumps back to the top of the trough. Maybe, if the scroll callback stored the last newpos, then when the callback fires a second time and the event is unknown, you could force the scroll bar to return to its last position using scrollSet? If you do manage to find a workaround, please let me know. On the plus side, Telelogic confirmed the bug for 8.3, but said that it was fixed in 9.0. I found that 8.1 was fine also. Paul |
|||||
![]() |
Telelogic DOORS
» DXL Exchange
»
Help with Scroll Bars in Canvas
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.