The Artima Developer Community
Sponsored Link

Agile Buzz Forum
How To Build A GUI With Pollock - Dynamic Scrollbars

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
How To Build A GUI With Pollock - Dynamic Scrollbars Posted: Mar 21, 2004 3:00 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: How To Build A GUI With Pollock - Dynamic Scrollbars
Feed Title: Pollock
Feed URL: http://www.cincomsmalltalk.com/rssBlog/pollock-rss.xml
Feed Description: Pollock - the next VW GUI
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Pollock

Advertisement

When in the course of ListBoxes, the list of items to be displayed is longer than the available vertical space, the developer will usually provide a vertical scrollbar. The problem comes when that ListBox, like our Protocol and Methods lists, are dynamic, and sometimes need a scrollbar and sometimes do not. It's not a big problem, however, since a scrollbar will disable itself if there is nothing to scroll. Indeed, the Pollock scrollbars work like that. None the less, having a widget thing taking up space on your UI is at best, ugly, and at worse, frustrating to the user.

Pollock solves that problem by allowing any pane that supports scrollbars to use dynamic scrollbars. That is, when the scrollbar would otherwise be disabled, it instead automatically disappears, only re-showing itself when needed. Like all of Pollock, it is fairly easy to use this feature:

createInterface
	...
	pane := ListBox new.
	pane beMultiSelect.
	pane frame: (FractionalFrame fractionTop: 0 right: 0.66 bottom: 0.5 left: 0.33).
	pane frame
		rightOffset: -1;
		leftOffset: 1;
		bottomOffset: -1.
	pane id: #ProtocolList.
	pane verticalScrollbar: true.
	pane dynamicScrollbars: true.
	self addComponent: pane.
	pane := ListBox new.
	pane frame: (FractionalFrame fractionTop: 0 right: 1 bottom: 0.5 left: 0.66).
	pane frame
		leftOffset: 1;
		bottomOffset: -1.
	pane id: #MethodList.
	pane verticalScrollbar: true.
	pane dynamicScrollbars: true.
	self addComponent: pane.
	...

The above is published as version 1.12 in the Package named "PollockBlog" on the Cincom public repository.

As you see, first we turn on the scrollbar we want, and then we tell them to be dynamic... actually, the order of those commands, as with most of Pollock is not important. Now, we open our browser:

	ClassHierarchyBrowser open

And as a test, we select the class Object. We instantly see that the scrollbar for the protocol list appears. If we select the one protocol, such as "accessing", the method list has not enough items to show the scrollbar. So, let's hold down the shift key, and click on a protocol about 4 or 5 down from "accessing". Again, without hesitation, the method scrollbar turns on, being now it has something to scroll.

Now for a bit of honesty. Right now, the TextEdit is in non-word wrap mode, and I wanted to add a horizontal scrollbar, and have it dynamic too. Unfortunately, several months ago I gutted the frame system in Pollock, and rewrote it to be dynamic, where, before, it was static. Seems I was very careful about doing the right thing with all of the Enumeration Panes when I fixed that, and just today, realized I wasn't as careful with the TextEdit. Basically, right now, if you turn on horizontal scrollbars for a TextEdit, they just sit there until you try to edit the text.

Accidentally, that plays into my plans. Next session, I wanted to show how to turn on WordWrap for TextEdit anyway. So, we'll just move ahead with that, and the following three sessions, MainMenu, Toolbar and Popup Menus.

After that, I will be taking a bit of time away from the blog, first to finish work on the TabControl, and to fix the scrollbar problem, as well as the "all bold" problem in the TextEdit that Vassili found. Then, I'll come back and show you how to use and add a TabControl, so we can switch between Class and Instance views for our browser


And So It Goes
Sames

Read: How To Build A GUI With Pollock - Dynamic Scrollbars

Topic: Code Coverage Previous Topic   Next Topic Topic: How To Build A GUI With Pollock - Multiple and Single Selection

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use