Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 19-Mar-2003 15:51
User is offline View Users Profile Print this message


Marc Battistello

Posts: 13
Joined: 19-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 17-Apr-2003 21:31
User is offline View Users Profile Print this message


Natalie Acheson

Posts: 5
Joined: 7-Nov-2002

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
Report this to a Moderator Report this to a Moderator
 13-Aug-2008 15:44
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

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


Report this to a Moderator Report this to a Moderator
 14-Aug-2008 15:12
User is offline View Users Profile Print this message


Paul Howstan

Posts: 47
Joined: 27-Sep-2006

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
Report this to a Moderator Report this to a Moderator
 14-Aug-2008 15:22
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

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
Report this to a Moderator Report this to a Moderator
 15-Aug-2008 08:55
User is offline View Users Profile Print this message


Paul Howstan

Posts: 47
Joined: 27-Sep-2006

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
Report this to a Moderator Report this to a Moderator
 15-Aug-2008 11:14
User is offline View Users Profile Print this message


Paul Howstan

Posts: 47
Joined: 27-Sep-2006

After talking to Telelogic, it is an issue with DOORS 8.3 patch 1, but is fixed in DOORS 9.
Report this to a Moderator Report this to a Moderator
 21-Aug-2008 21:11
User is offline View Users Profile Print this message


Gordon Woods

Posts: 35
Joined: 2-Mar-2007

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
Report this to a Moderator Report this to a Moderator
 22-Aug-2008 08:27
User is offline View Users Profile Print this message


Paul Howstan

Posts: 47
Joined: 27-Sep-2006

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.