Just a quick question, assume we have a GControlPalette control. with an icon
[I] and three controls
C and the preferred side is
EAST, then when the mouse is over the icon we will get something like
[I](A B C)
Now if we change the side to
WEST, perhaps because we have dragged the icon too close to the right side then we have two options
(A B C)[I] or
(C B A )[I]
The same argument also applies to
I have a personal preference but I would like to know what you think before I make a decision.
For me it would be
(C B A)[I]
As I would likely organise the controls so that the most used was always closest to the icon.
Glad to see we are in agreement
I have made some changes to the user requirements and incorporated your ideas and I have renamed the panel part as the palette part
Requirements specification for the GControlPalette
- This control would represent a rectangular area containing 1 or more G4P controls
- The control will have two principal parts, the tab and the palette.
- The controls would laid out either horizontally or vertically on the palette
- The palette will only be visible when the control is active
- The control is activated when the mouse passes over the tab part
- The control remains active (visible palette) while the mouse is over the tab or palette
- When visible the palette part will have a visual border and an optional opaque background
- The tab would be a small rectangular area containing an icon. Its size would be the same as image.
- The user can set the preferred side of the tab for the palette to appear. This preferred position would be used unless it means that part of the panel is off window.
- The control can be moved by dragging the tab
- The user can lock the controls position at any time to prevent dragging
- The palette size will be determined by the size of the controls added
- No provision will be made if the control’s width and/or height exceed the window’s width and/or height e.g. the window has been resized or too many controls have been added.
- The order controls on the palette is determined by the user and will be displayed radially starting from the tab.
This video shows where I am upto with the development
All looks good to me
I do have a couple of questions about (7)
Can the strokeWeight & corner radius of the visual border be set by the user ? I’m not sure if you can with other G4P Controls ?
I presume that both border and opague bkgrd colours can be set using a user(color)palette.png ?
No but it doesn’t mean they can’t be included.
G4P uses colour schemes but you can set individual colours - see the G4P guides on my website
At the moment I am concentrating on the control behaviour methods because they are the most complex algorithms to develop. Methods for controlling attributes which are easy-peasy
Sorry, yes I meant colour schemes, have now found
setLocalColor() that should do it.
I was thinking about calling the class
GControlRibbon rather than
GControlPalette, ribbon is more 1D whereas palette suggests 2D arrangement. What do you think?
Can kinda see your point with palette inferring 2D, though Ribbon to me doesn’t really give a clue to it’s function of holding other controls.
How about :
Shelf ? (what I was first thinking when trying to build one)
Drawer ? (maybe a bit 2D as well)
Could always have 1D and 2D Palettes !
Your library your call really
I will stick with
GControlPalette for the moment. The class is written but needs testing, do you want to give it a workout?
If so you can download an archived sketch which I have been using for basic testing including adding / removing controls on the palette. You can download the sketch by clicking here
Once downloaded it should be unzipped into your sketchbook folder with your other sketches. Restart Processing and the sketch will use the version of G4P included in the downloaded sketch. It will not affect any other sketches because they will use the version you have installed.
Please try it out and see how it performs with other G4P controls.
Do you intend to try this control out?
Sorry Peter, Had downloaded the sketch in the week, tested the two Palettes in there, which all seem good.
Then intended to try with other controls and get back to you, but life got a bit hectic.
I have time today so will test further.
NP just thought you might have missed the message. No rush I am working on numeric input field.
What should the palette index for the GControlPalette background color and border color be when using .setLocalColor() ?
I took a guess at the same as GPanel… but doesn’t seem to have any effect.
What is the possible input range for border stroke weight and corner radius ?
I can see that corner radius is working within a small range but I can’t seem to get the border stroke weight to do anyting noticable.
What is the minimum padding value ? I tried to pack btns really close but seems the minimum is maybe around 4 ?
The palette icon: I haven’t really used the new Icons in 4.1 so please excuse any stupid questions in regard to these and I may have confused matters by using the word icon earlier and just meaning an image not an animated icon…so with that out the way.
How should you use a simple image as the tab ‘icon’ on the palette, I bodged in a singleimage .png to the GAnimicon and set nbrRows and nbrCols to 1 and left interval as 100.
Couple of bugs - the radius was pegged at 2 * PADDING and the borderweight fixed at 1
The minimum padding is 2px all round the control but that makes 4px between controls.
Although I have used an animated icon (GAnimIcon) you can use simple static icons with (GIcon). The constructor accepts both GIcon and GAnimIcon
So far so good you have highlighted some issues which I have fixed in the source code.
Let me know how it the palette works with other controls on it.
Thanks for your help
Thanks for the info, I hadn’t looked at GIcon at all…doh!
I have tested with image & imageToggle buttons, GCheckbox, GStick, GSlider2D and GKnob. These all seem to work as intended.
One thing that does not seem to work is a GTogglegroup (could maybe be my mistake) having built a group of 3 GOption, when added to the GPalette they are spaced out indivdually rather than as intended in the group stacked above each other (They should all have had same X pos but each have own Y pos i.e NORTH,CENTER,SOUTH)
What determines the ‘flipover’ point when the Palette tab moves from EAST to WEST ?
Other than the slider thats in your test and the number input field you’re working on I can’t really think of any other controls that I would be likely to put in a palette, I wouldn’t put any other textfields or drop lists in there.
So not bad so far except GToggleGroup possible problem.
The GToggleGroup manages exclusive-or selection between GOption controls - so when one is selected it deselects the previous selection. They will work in the NORTH SOUTH orientation but not EW because the controls are stored in a list and are centred about the mid height for EW and mid width for NS alignments.
I will look ate ways round it but not certain yet.
When the GControlPalette the user specifies a preferred orientation. It will use this preferred orientation provided the entire palette can be displayed, otherwise it will show the opposite orientation. If neither is entirely visible then it shows as much or the preferred as possible.
Tested and yes works fine
You have not reported any problems with the GContolPalette control so I assume it is OK.
I have been experimenting with different approaches to users entering numeric input and there seems to be two approaches
- reject keys which would make the input an invalid number
- accept all keys but give a visual indication when the number is invalid
The first approach sounds good but is a nightmare to implement because you can have text which is not a valid number in itself but can become valid with additional input for example
Imagine typing in the number
-2.579E-2 there are three intermediate invalid number states
So the question is what do we do with these invalid inputs and there is no easy solution so I am looking at option (2) which would involve only minor changes to the