christmo / macwidgets

Automatically exported from code.google.com/p/macwidgets
0 stars 0 forks source link

Feature Request: Add support for text in a Pop*Button #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Original Forum Post:

Hey all, I was wondering if somebody could give me a hint as to how I 
would go about adding a text to a PopdownButton? 
i.e. after choosing one of the menu items, that menu item's text would 
show up on the button. 
Thanks. -Zack 

===============

Screenshot 1 shows what I was going for, screenshot 2 was my attempt to hack 
something in 
using the following code:

//Hack to add text to the popdown buttton
EPToggleButton toggle_button = (EPToggleButton) viewTypeButton.getComponent();
toggle_button.setText("testing button text");

See the attached java file for a runnable test.

Prefereably it would be possible to have the text to the left or to the right 
of the icon, and the 
ability to specify a width for the button (so that text updates don't mess with 
the layout).

Let me know if I can add any more info.

Original issue reported on code.google.com by zachary....@gmail.com on 5 Jan 2009 at 7:26

Attachments:

GoogleCodeExporter commented 8 years ago
This will all be much easier once I'm using a ComboBoxUI delegate (I have the 
preliminary implementation 
working for HUD controls).

Do you want this functionality on PopupButton instead? It looks that way from 
your usage (those arrow icons are 
for popup style buttons, where the menu displays over the button).

Original comment by kenneth....@gmail.com on 5 Jan 2009 at 10:20

GoogleCodeExporter commented 8 years ago
I see, your actually using both PopupButton and PopdownButton - so the answer 
is you need this functionality on 
both.

Original comment by kenneth....@gmail.com on 5 Jan 2009 at 10:21

GoogleCodeExporter commented 8 years ago
I'm going to have to think about this one a little more. I want to make sure it 
works simply and easily. Lets 
recap what your asking for:

You want Popdown button that:

1) Lets you base the text based on which menu item is selected, but keeps the 
icon the same (and doesn't 
show the icon in the popup menu)
2) Lets you position the text horizontally relative to the icon

Have you seen other apps that use this type of button? Why not use a 
PopupButton for this?

Thanks for your patience Zack - I just want to get the full scoop before we 
make any changes.

-Ken

Original comment by kenneth....@gmail.com on 6 Jan 2009 at 12:44

GoogleCodeExporter commented 8 years ago
> Have you seen other apps that use this type of button? Why not use a 
PopupButton for this?
Can't think of any off the top of my head, I was thinking it would be nice to 
be able to glance at the button to 
see which menu item was last chosen.  

> This will all be much easier once I'm using a ComboBoxUI delegate
Now that you mention it, the functionality would make more sense as a combo box

> Thanks for your patience Zack - I just want to get the full scoop before we 
make any changes.
No rush ken, I'll probably hack something in for now (and post the patch in 
case anybody else needs this 
asap), but as per your comments this may be more of a combo box thing than a 
Pop*Button thing.

Thanks, -Zack

Original comment by zachary....@gmail.com on 6 Jan 2009 at 1:46

GoogleCodeExporter commented 8 years ago
See attached for a better idea of what I'm going for.  I havn't really looked 
at PopupButton, I did notice it's 
parameterized, where PopdownButton isn't.

Also removed the stray dependencies on my codebase.

Original comment by zachary....@gmail.com on 6 Jan 2009 at 2:03

Attachments:

GoogleCodeExporter commented 8 years ago
Give PopupButton a try - it handles drawing the arrows for you. The only thing 
it doesn't yet support is an icon 
(usually these types of buttons are text based). PopupButton will also figure 
out how wide to make the button 
based on the items in your popup.

You've helped me see the disparities in the PopupButton and PopdownButton APIs 
- the APIs should be more 
similar than they are but help guide you toward the standard behavior.

Let me know if PopupButton works for you.

-Ken 

Original comment by kenneth....@gmail.com on 6 Jan 2009 at 1:20

GoogleCodeExporter commented 8 years ago
Thanks ken, I switched to using PopupButton.  Are you thinking about making 
PopdownButton more like 
PopupButton, or vice-versa?

Thanks, -Zack

Original comment by zachary....@gmail.com on 16 Jan 2009 at 7:24

GoogleCodeExporter commented 8 years ago
Hi Zack,

I would probably make PopupButton more like PopdownButton (i.e. use the 
PopupMenuCustomizer stuff). I could 
be persuaded either way though if you have thoughts on the matter.

-Ken

Original comment by kenneth....@gmail.com on 16 Jan 2009 at 11:49

GoogleCodeExporter commented 8 years ago
Hi Zack,

Are you all set using PopupButton? If so, I'll close this issue. At some point 
in the future, I'll introduce a new 
mechanism for creating these types of buttons that use a JComboButton instead.

-Ken

Original comment by kenneth....@gmail.com on 30 Jan 2009 at 1:05

GoogleCodeExporter commented 8 years ago
I haven't heard back on this, so I'll assume you're all set.

Original comment by kenneth....@gmail.com on 3 Feb 2009 at 9:35