Re: would like a stock button without the text (GtkButton), or a stock GtkToolButton that gets button-pressed-event
Gergely Polonkai <[email protected]> Sat, 25 Jun 2016 23:59:57 +0200
| Newsgroups | gmane.comp.gnome.glade.user |
|---|---|
| Message-ID | <CACczBUK3-ADSiLvqS62zE5L6bfqpZS-dGBzAaWxAt276m2Ghfw@mail.gmail.com> |
--===============0326523105== Content-Type: multipart/alternative; boundary=001a114b0cfa87059f05362168f9 --001a114b0cfa87059f05362168f9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have no idea, but maybe I would take a look into GtkSpinButton=E2=80=99s = 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" <[email protected]> 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, i= t > 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 an= d > do it all, or something similar, purely in glade, then i would be even mo= re > grateful, and try it out. > > Thanks for all your help! > > dan > > On Sat, Jun 25, 2016 at 2:17 AM, Gergely Polonkai <[email protected]> > wrote: > >> Hello, >> >> you=E2=80=99re 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 u= se >> cases for this signal (and because I prefer using GtkActions). >> >> Best, >> Gergely >> On Jun 25, 2016 04:59, "Dan Hitt" <[email protected]> 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 c= ould >>> 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 probl= em. >>> >>> 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 <[email protected]> >>> wrote: >>> >>>> Add a GtkButton, and inside a GtkImage. If you are using the Glade UI, >>>> you have to check the =E2=80=9CAdd custom content=E2=80=9D 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 <[email protected]= > >>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> how about you create a simple button, and add an image inside? Button= s >>>>> are containers, you can put anything inside (even a button, but that >>>>> doesn=E2=80=99t make much sense). >>>>> >>>>> Best, >>>>> Gergely >>>>> >>>>> >>>>> >>>>> Gergely Polonkai >>>>> [image: https://]about.me/gergely.polonkai >>>>> >>>>> <https://about.me/gergely.polonkai?promo=3Demail_sig&utm_source=3Dema= il_sig&utm_medium=3Demail_sig&utm_campaign=3Dexternal_links> >>>>> >>>>> 2016-06-24 7:49 GMT+02:00 Dan Hitt <[email protected]>: >>>>> >>>>>> 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, bu= t >>>>>> 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-even= t >>>>>> and button-released-event, but if it's a stock button, there does no= t >>>>>> 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 - [email protected] >>>>>> http://lists.ximian.com/mailman/listinfo/glade-users >>>>>> >>>>> >>>>> >>>> >>> > --001a114b0cfa87059f05362168f9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p dir=3D"ltr">I have no idea, but maybe I would take a look into GtkSpinBu= tton=E2=80=99s sources; the up/down (well, plus and minus) buttons do exact= ly what you want to achieve. Dig yourself into gtkspinbutton.c, it may hold= the answer for you ;)</p> <div class=3D"gmail_quote">On Jun 25, 2016 17:30, "Dan Hitt" <= <a href=3D"mailto:[email protected]">[email protected]</a>> wrote:<br = type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 = 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><= div><div><div><div><div><div><div><div>Oh for sure!<br><br></div>And if the= re's a better way to handle my use case i'm all ears.<br><br></div>= What i would like to happen is that if i press the button, and hold it, it = starts repeating.<br><br></div>Ideally, it would repeat slowly at first, bu= t as time wears on repeat faster and faster.<br><br></div>If there were an = attribute in the glade gui that said 'auto-repeat', i would just ch= eck it and let the gtk machinery take care of the rest.<br><br></div>But af= aict, i'm going to need to program it.<br><br></div>I have not done thi= s yet, and it is of course a language-specific question, but i imagine i= 9;ll fire some kind of timeout on the first press, and clear it on the rele= ase, but until there's a release doing my action each time it times out= while shortening the next period.<br><br></div>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 o= ut.<br><br></div>Thanks for all your help!<br><br></div>dan<br></div><div c= lass=3D"gmail_extra"><br><div class=3D"gmail_quote">On Sat, Jun 25, 2016 at= 2:17 AM, Gergely Polonkai <span dir=3D"ltr"><<a href=3D"mailto:gergely@= polonkai.eu" target=3D"_blank">[email protected]</a>></span> wrote:<br= ><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1= px #ccc solid;padding-left:1ex"><p dir=3D"ltr">Hello,</p> <p dir=3D"ltr">you=E2=80=99re welcome.</p> <p dir=3D"ltr">On a side note, could you elaborate on why you need the butt= on-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).</= p> <p dir=3D"ltr">Best,<br> Gergely</p><div><div> <div class=3D"gmail_quote">On Jun 25, 2016 04:59, "Dan Hitt" <= <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]<= /a>> wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" st= yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div = dir=3D"ltr"><div><div><div><div><div><div>Ah, thank you very much Gergely.<= br><br></div>This is exactly what i need.<br><br></div>A little elaboration= here as to what i'm doing: i want to isolate as much of the gui develo= pment to glade as possible, because it will make the app look more like oth= er apps, and probably be better than anything i could do.<br><br></div>And = i want to avoid text on buttons as much as possible for all the usual reaso= ns.<br><br></div>I thought GtkToolButton was ideal for what i wanted, but i= t has trouble getting the button-press-event signal, while a button has no = such problem.<br><br></div>Anyhow, i appreciate your help very much, and it= lets me get on my way.<br><br></div>dan<br></div><div class=3D"gmail_extra= "><br><div class=3D"gmail_quote">On Fri, Jun 24, 2016 at 8:24 AM, Gergely P= olonkai <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>></span> wrote:<br><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex"><p dir=3D"ltr">Add a GtkButton, and inside a GtkImage. If you= are using the Glade UI, you have to check the =E2=80=9CAdd custom content= =E2=80=9D checkbox in the button properties.</p> <p dir=3D"ltr">Best,<br> Gergely</p><div><div> <div style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex= "><div dir=3D"ltr"><div><div><div>Thanks Gergely for your suggestion.<br><b= r></div>But how would i do that entirely in glade, and using only stock ima= ges?<br><br></div>TIA for any info.<br><br></div>dan<br></div><div class=3D= "gmail_extra"><br><div class=3D"gmail_quote">On Fri, Jun 24, 2016 at 1:04 A= M, Gergely Polonkai <span dir=3D"ltr"><<a href=3D"mailto:gergely@polonka= i.eu" target=3D"_blank">[email protected]</a>></span> wrote:<br><block= quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc= solid;padding-left:1ex"><div dir=3D"ltr">Hello,<div><br></div><div>how abo= ut you create a simple button, and add an image inside? Buttons are contain= ers, you can put anything inside (even a button, but that doesn=E2=80=99t m= ake much sense).</div><div><br></div><div>Best,</div><div>Gergely</div></di= v><div class=3D"gmail_extra"><br clear=3D"all"><div><div data-smartmail=3D"= gmail_signature"><div dir=3D"ltr"><table style=3D"margin:0px;padding:0px;bo= rder:0px;outline:0px;font-size:16px;font-family:proxima-nova-1,proxima-nova= -2,Tahoma,Helvetica,Verdana,sans-serif;vertical-align:baseline;border-spaci= ng:0px;color:rgb(51,51,51);line-height:22.4px;text-align:center" border=3D"= 0" cellpadding=3D"0" cellspacing=3D"0"><tbody style=3D"margin:0px;padding:0= px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-famil= y:inherit;vertical-align:baseline"><tr style=3D"margin:0px;padding:0px;bord= er:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inher= it;vertical-align:baseline"><td style=3D"padding:0px;border:0px;outline:0px= ;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseli= ne;text-align:left;width:auto;height:20px">=C2=A0</td></tr><tr style=3D"mar= gin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:i= nherit;font-family:inherit;vertical-align:baseline"><td style=3D"padding:0p= x;border:0px;outline:0px;font-style:inherit;font-family:inherit;vertical-al= ign:baseline;text-align:left;width:auto"><div style=3D"margin:0px;padding:0= px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-famil= y:inherit;vertical-align:baseline;line-height:0"><a href=3D"https://about.m= e/gergely.polonkai?promo=3Demail_sig&utm_source=3Demail_sig&utm_med= ium=3Demail_sig&utm_campaign=3Dexternal_links" style=3D"margin:0px;padd= ing:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-= family:inherit;vertical-align:baseline;color:rgb(43,130,173);text-decoratio= n:none;display:inline-block" target=3D"_blank"><table style=3D"margin:0px;p= adding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;fo= nt-family:inherit;vertical-align:baseline;border-spacing:0px" border=3D"0" = cellpadding=3D"0" cellspacing=3D"0"><tbody style=3D"margin:0px;padding:0px;= border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:i= nherit;vertical-align:baseline"><tr style=3D"margin:0px;padding:0px;border:= 0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;= vertical-align:baseline"><td style=3D"padding:0px;border:0px;outline:0px;fo= nt-style:inherit;font-family:inherit;vertical-align:top;width:auto;line-hei= ght:1" align=3D"left" valign=3D"top"><div style=3D"margin:0px;padding:0px;b= order:0px;outline:0px;font-weight:bold;font-style:inherit;font-size:18px;fo= nt-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-a= lign:baseline;line-height:1;color:rgb(51,51,51)">Gergely Polonkai</div></td= ></tr><tr style=3D"margin:0px;padding:0px;border:0px;outline:0px;font-weigh= t:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><= td style=3D"padding:0px;border:0px;outline:0px;font-style:inherit;font-fami= ly:inherit;vertical-align:top;width:auto;line-height:1" align=3D"left" vali= gn=3D"top"><div style=3D"margin:3px 0px 0px;padding:0px;border:0px;outline:= 0px;font-weight:inherit;font-style:inherit;font-size:12px;font-family:proxi= ma-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline">= <img alt=3D"https://" style=3D"margin:0px;padding:0px;border:0px;outline:0p= x;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align= :baseline;display:block;width:0px;min-height:0px;overflow:hidden" height=3D= "0" width=3D"0">about.me/gergely.polonkai</div></td></tr></tbody></table></= a></div></td></tr><tr style=3D"margin:0px;padding:0px;border:0px;outline:0p= x;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align= :baseline"><td style=3D"padding:0px;border:0px;outline:0px;font-style:inher= it;font-size:0px;font-family:inherit;vertical-align:baseline;text-align:lef= t;width:auto;height:20px"><img src=3D"https://about.me/t/sig?u=3Dgergely.po= lonkai" style=3D"margin:0px;padding:0px;border:0px;outline:0px;font-weight:= inherit;font-style:inherit;font-family:inherit;vertical-align:baseline;over= flow:hidden" height=3D"1" width=3D"1"></td></tr></tbody></table></div></div= ></div> <br><div class=3D"gmail_quote"><div><div>2016-06-24 7:49 GMT+02:00 Dan Hitt= <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_bla= nk">[email protected]</a>></span>:<br></div></div><blockquote class=3D"= gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-= left:1ex"><div><div>I would like to have a widget, created in glade, that a= cts like a<br> button in that it gets button-press-event, and has a stock image, but<br> does not have any text label.<br> <br> A GtkToolButton almost fits the bill, in that it has an image but no text.<= br> <br> However, if you put signal handlers on a GtkToolButton, you can see<br> when it is clicked, or gets a button-released-event, but the<br> button-pressed-events are unreliable.=C2=A0 =C2=A0In my setup, they only sh= ow up<br> for double clicks.<br> <br> On the other hand a GtkButton certainly does get button-pressed-event<br> and button-released-event, but if it's a stock button, there does not<b= r> seem to be a way to tell it to just not show any text.<br> <br> I would like to do this entirely in glade, without writing any code,<br> and using only standard images.<br> <br> Is this possible?<br> <br> I'm using xubuntu 16.04, and the glade which comes with it which is 3.1= 8.3.<br> <br> Thanks in advance for any clues, and i can provide more details if i'm<= br> leaving something out here.<br> <br> dan<br></div></div> _______________________________________________<br> Glade-users maillist=C2=A0 -=C2=A0 <a href=3D"mailto:[email protected]= an.com" target=3D"_blank">[email protected]</a><br> <a href=3D"http://lists.ximian.com/mailman/listinfo/glade-users" rel=3D"nor= eferrer" target=3D"_blank">http://lists.ximian.com/mailman/listinfo/glade-u= sers</a><br> </blockquote></div><br></div> </blockquote></div><br></div> </div> </div></div></blockquote></div><br></div> </blockquote></div> </div></div></blockquote></div><br></div> </blockquote></div> --001a114b0cfa87059f05362168f9-- --===============0326523105== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Glade-users maillist - [email protected] http://lists.ximian.com/mailman/listinfo/glade-users --===============0326523105==--