The Artima Developer Community
Sponsored Link

Agile Buzz Forum
How To Create A Custom Widget - Final Motif Look Changes

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 Create A Custom Widget - Final Motif Look Changes Posted: Dec 22, 2004 2:46 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: How To Create A Custom Widget - Final Motif Look Changes
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

Today we tweak the grid for the Motif look, so that all columns and rows are fully displayed.


Simple Design

There are any number of ways to deal with the problem, but the simplest is simply to change the size of the grid for the specific look. Currently, the grid is offset 25 from the top, and 5 from the bottom. That is fine for the Windows look, but not in the Motif look, the bottom row displays partially below the bottom edge of the grid. After a bit of research, it turns out that the grid is about 7 pixels too short in height.

If we clip 4 pixels from the top and 3 from the bottom, we'll be just fine. Here we'll finally make real use of our MotifCalendarArtist. But first, let's get the basics done.

For the standard/Windows look, we'll add two methods to the CalendarArtist:

	CalendarArtist>>gridBottomOffset
		^-5

	CalendarArtist>>gridTopOffset
		^25	

Now, we'll change the #addCalendarGridTo: method in the CalendarAgent to use these values

	CalendarAgent>>addCalendarGridTo: aForm 
		| grid |
		grid := Grid new.
		grid foregroundColorAction: [:cell | self foregroundColorFor: cell].
		grid frame: (FractionalFrame fractionLeft: 0 right: 1 top: 0 bottom: 1).
		grid frame
			leftOffset: 5;
			rightOffset: -5;
			bottomOffset: self artist gridBottomOffset;
			topOffset: self artist gridTopOffset.
		grid list: self currentMonthModel.
		self addColumnsTo: grid.
		grid selectByCells.
		grid when: #cellSelected: send: #selectDateAt: to: self.
		grid when: #selectionChangeFinished send: #closeDropDown to: self.
		grid 
			columnHeader: true;
			allowColumnResizing: false;
			allowColumnReordering: false;
			allowRowResizing: false;
			allowSorting: false;
			displayExtendedRowLines: true.
		aForm addComponent: grid

Finally, we add #gridBottomOffset and #gridTopOffset methods to the MotifCalendarArtist with their own values:

	MotifCalendarArtist>>gridBottomOffset
		^-2

	MotifCalendarArtist>>gridTopOffset
		^21

The work we already have done to change the Artist when the look changes takes care of making the right method is called and the look specific value is used.

Yes, the fix is just that easy...

What we could have done is gone and asked the Grid what the size of all the lines it displayed were, and then change the size of the Grid based on that calculation... But I'm feeling lazy as the end of the year comes near, so I leave that as an exercise for you my gentle reader, if you so want.

The above is published as version 1.19 in the Package named "Pollock-Calendar" on the Cincom public repository.


Announcement

Now that VisualWorks 7.3 NC has been made publicly available, I have published the version of Pollock that goes with 7.3 on the VisualWorks Public Repository. It is published as version 5.40.1, and is the same version that is on the 7.3 disk, but with a handful of fixes that didn't make it between then and now.

For those using an earlier version of VisualWorks, I haven't tested 5.40.1 against anything but 7.3. It may work fine, it may not. I did make some changes along the way to accommodate changes in 7.3 itself, so I can't be fully sure if those changes affect using 5.40.1 on 7.2.1 or earlier.


Solstice Sign Off

Yesterday, being the shortest daylight day of the year here in the northern hemisphere, has, as it at this time every year, triggered my hibernation instinct. So, I'll be taking a few weeks off to sleep and recharge for 2005.

When I return in late January, we'll tackle doing all the fancy MacOSX look issues.

Till then... Sweet Dreams Everyone.


And So It Goes
Sames

Read: How To Create A Custom Widget - Final Motif Look Changes

Topic: Clearing the decks Previous Topic   Next Topic Topic: Dohh

Sponsored Links



Google
  Web Artima.com   

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