[Glade-users] would like a stock button without the text (GtkButton), or a stock GtkToolButton that gets button-pressed-event
Gergely Polonkai
gergely at polonkai.eu
Sat Jun 25 21:59:57 UTC 2016
I have no idea, but maybe I would take a look into GtkSpinButton’s sources;
the up/down (well, plus and minus) buttons do exactly what you want to
achieve. Dig yourself into gtkspinbutton.c, it may hold the answer for you
;)
On Jun 25, 2016 17:30, "Dan Hitt" <dan.hitt at gmail.com> wrote:
> Oh for sure!
>
> And if there's a better way to handle my use case i'm all ears.
>
> What i would like to happen is that if i press the button, and hold it, it
> starts repeating.
>
> Ideally, it would repeat slowly at first, but as time wears on repeat
> faster and faster.
>
> If there were an attribute in the glade gui that said 'auto-repeat', i
> would just check it and let the gtk machinery take care of the rest.
>
> But afaict, i'm going to need to program it.
>
> I have not done this yet, and it is of course a language-specific
> question, but i imagine i'll fire some kind of timeout on the first press,
> and clear it on the release, but until there's a release doing my action
> each time it times out while shortening the next period.
>
> So that's the plan, but if you have a way to skip the programming part and
> do it all, or something similar, purely in glade, then i would be even more
> grateful, and try it out.
>
> Thanks for all your help!
>
> dan
>
> On Sat, Jun 25, 2016 at 2:17 AM, Gergely Polonkai <gergely at polonkai.eu>
> wrote:
>
>> Hello,
>>
>> you’re welcome.
>>
>> On a side note, could you elaborate on why you need the button-pressed
>> event instead of clicked? Just out of curiosity, as I rarely see valid use
>> cases for this signal (and because I prefer using GtkActions).
>>
>> Best,
>> Gergely
>> On Jun 25, 2016 04:59, "Dan Hitt" <dan.hitt at gmail.com> wrote:
>>
>>> Ah, thank you very much Gergely.
>>>
>>> This is exactly what i need.
>>>
>>> A little elaboration here as to what i'm doing: i want to isolate as
>>> much of the gui development to glade as possible, because it will make the
>>> app look more like other apps, and probably be better than anything i could
>>> do.
>>>
>>> And i want to avoid text on buttons as much as possible for all the
>>> usual reasons.
>>>
>>> I thought GtkToolButton was ideal for what i wanted, but it has trouble
>>> getting the button-press-event signal, while a button has no such problem.
>>>
>>> Anyhow, i appreciate your help very much, and it lets me get on my way.
>>>
>>> dan
>>>
>>> On Fri, Jun 24, 2016 at 8:24 AM, Gergely Polonkai <gergely at polonkai.eu>
>>> wrote:
>>>
>>>> Add a GtkButton, and inside a GtkImage. If you are using the Glade UI,
>>>> you have to check the “Add custom content” checkbox in the button
>>>> properties.
>>>>
>>>> Best,
>>>> Gergely
>>>> Thanks Gergely for your suggestion.
>>>>
>>>> But how would i do that entirely in glade, and using only stock images?
>>>>
>>>> TIA for any info.
>>>>
>>>> dan
>>>>
>>>> On Fri, Jun 24, 2016 at 1:04 AM, Gergely Polonkai <gergely at polonkai.eu>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> how about you create a simple button, and add an image inside? Buttons
>>>>> are containers, you can put anything inside (even a button, but that
>>>>> doesn’t make much sense).
>>>>>
>>>>> Best,
>>>>> Gergely
>>>>>
>>>>>
>>>>>
>>>>> Gergely Polonkai
>>>>> [image: https://]about.me/gergely.polonkai
>>>>>
>>>>> <https://about.me/gergely.polonkai?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links>
>>>>>
>>>>> 2016-06-24 7:49 GMT+02:00 Dan Hitt <dan.hitt at gmail.com>:
>>>>>
>>>>>> I would like to have a widget, created in glade, that acts like a
>>>>>> button in that it gets button-press-event, and has a stock image, but
>>>>>> does not have any text label.
>>>>>>
>>>>>> A GtkToolButton almost fits the bill, in that it has an image but no
>>>>>> text.
>>>>>>
>>>>>> However, if you put signal handlers on a GtkToolButton, you can see
>>>>>> when it is clicked, or gets a button-released-event, but the
>>>>>> button-pressed-events are unreliable. In my setup, they only show up
>>>>>> for double clicks.
>>>>>>
>>>>>> On the other hand a GtkButton certainly does get button-pressed-event
>>>>>> and button-released-event, but if it's a stock button, there does not
>>>>>> seem to be a way to tell it to just not show any text.
>>>>>>
>>>>>> I would like to do this entirely in glade, without writing any code,
>>>>>> and using only standard images.
>>>>>>
>>>>>> Is this possible?
>>>>>>
>>>>>> I'm using xubuntu 16.04, and the glade which comes with it which is
>>>>>> 3.18.3.
>>>>>>
>>>>>> Thanks in advance for any clues, and i can provide more details if i'm
>>>>>> leaving something out here.
>>>>>>
>>>>>> dan
>>>>>> _______________________________________________
>>>>>> Glade-users maillist - Glade-users at lists.ximian.com
>>>>>> http://lists.ximian.com/mailman/listinfo/glade-users
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/glade-users/attachments/20160625/6d728fa2/attachment-0001.html>
More information about the Glade-users
mailing list