[Cuis-dev] Panel

Hilaire Fernandes hilaire at drgeo.eu
Thu Oct 28 13:03:29 PDT 2021


Nicer :)

  * For me the colours does not work. (see a proposal changeset)
  * The size of the disc should change with font size changing  (change
    set too)
  * When you click on the label of a radio entry, the button should
    change its state too. Some more work, you want the RadioButtonMorph
    to be a layout morph composed with a kind of ellipse and a second
    morph, could be a label but also an arbitrary morph passed as an
    argument by the user. So you can radio with more graphic stuff
  * When you drag around a panel with radio button, the radio button are
    doing a belly dance. It seems to be a problem of the Panel itself.
    Rounding issue with integer?
  * In a Panel to edit layout/space, when I try to edit the layout morph
    containing the button and label, I can't adjust the alignment. It
    does not work. Am I missing something?

See below:


Best regards.

With nice panel, feature complete people will likely use it in their own 
project.

Hilaire


Le 27/10/2021 à 23:07, ken.dickey at whidbey.com a écrit :
> Hiliare,
>
> Panel title should now work as expected.
>
> Radio group labels should be centered vertically.
>
> Just pull 'Morphic-Misc1' package and reload.

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211028/432ea534/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran de 2021-10-28 21-28-48.png
Type: image/png
Size: 128450 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211028/432ea534/attachment-0001.png>
-------------- next part --------------
'From Cuis 5.0 [latest update: #4954] on 28 October 2021 at 9:55:41 pm'!

!RadioButtonMorph methodsFor: 'as yet unclassified' stamp: 'hlsf 10/28/2021 21:37:11'!
defaultColor
	^ `Color white`! !


!RadioGroup methodsFor: 'events-processing' stamp: 'hlsf 10/28/2021 21:49:00'!
fontPreferenceChanged

	| labelStrings maxStringWidth labelLayoutSpec |
	super fontPreferenceChanged.
	self setFont: Preferences standardButtonFont.
	maxStringWidth := 3. "minimum"
	labelStrings := self labelStrings.
	labelStrings do: [ :str |
		maxStringWidth := maxStringWidth max:  (self font widthOfString: str)
	].
	labelLayoutSpec := 
			LayoutSpec 
					fixedWidth: maxStringWidth + 4
					fixedHeight: self font lineSpacing + 2
					offAxisEdgeWeight: #center. 
	self submorphsDo: [ :selectLine |
		selectLine submorphsDo: [ :aMorph |
			(aMorph respondsTo: #setFont:)
				ifTrue: [ aMorph setFont: Preferences standardButtonFont ].
			(aMorph respondsTo: #font:)
				ifTrue: [ aMorph font: Preferences standardButtonFont ].
			(aMorph respondsTo: #ofSize:)
				ifTrue: [aMorph ofSize: RadioButtonMorph defaultDiameter].
			((aMorph isKindOf: LabelMorph)
			  and: [labelStrings includes: aMorph contents])
				ifTrue: [ aMorph layoutSpec: labelLayoutSpec ].
		]
	].! !


!RadioButtonMorph methodsFor: 'initialization' stamp: 'hlsf 10/28/2021 21:52:06'!
initialize

	super initialize.
	isSelected := false.
	self borderColor: Color black.
	self ofSize: self defaultDiameter! !

!RadioButtonMorph methodsFor: 'initialization' stamp: 'hlsf 10/28/2021 21:53:07'!
ofSize: numPixels
| size scale |
	scale _  Preferences standardButtonFont pointSize / 14.0.
	size _ numPixels * scale.
	self borderWidth: ((self defaultBorderWidth * scale) max: 1).
	self morphExtent: size @ size.
	self layoutSpec: (LayoutSpec 
							fixedWidth: size 
							fixedHeight: size
							offAxisEdgeWeight:  #center) ! !

!RadioButtonMorph methodsFor: 'event handling' stamp: 'hlsf 10/28/2021 21:36:12'!
mouseEnter: event
	"The mouse has entered the area of the receiver"

	self isSelected ifFalse: [ self fillColor: Color gray ]! !



More information about the Cuis-dev mailing list