Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Gui: create fully hidden submit button (no space allocation)


  • Please log in to reply
6 replies to this topic
Matt123
  • Members
  • 6 posts
  • Last active: Feb 12 2012 02:10 PM
  • Joined: 22 Nov 2011
Hi,
I want to create a GUI that consists of a single "edit" text input line and nothing else. Hitting enter should "submit" the GUI.

I am now creating a submit button via:
gui, add, button, hidden default gGo
but this causes the GUI to expand in order to accomodate the "Go" button, although the button itself is not shown. How can I get the button to be completely hidden?

(Another, unrelated GUI question, while we're at it: I would like to have an "edit" field with white text on black background. I can achieve this, but ther is a ~2px white border around the edit field...how do I get rid of that?)

Thanks!

Cerberus
  • Members
  • 175 posts
  • Last active: Aug 17 2017 05:01 PM
  • Joined: 20 Jul 2009
Why don't you just get rid of the button all together? You can make an Enter hotkey to submit and hide the GUI.

tomoe_uehara
  • Members
  • 2166 posts
  • Last active: Jun 11 2015 05:33 PM
  • Joined: 05 Sep 2009
Gui, Margin, 0, 0

Gui, Color, 000000, 000000

Gui, Font, cFFFFFF

Gui, Add, Edit, vMyEdit gSubmit w100

Gui, Show,, My GUI

return



Submit:

Gui, Submit, NoHide

ToolTip % MyEdit

return



ESC::ExitApp


Matt123
  • Members
  • 6 posts
  • Last active: Feb 12 2012 02:10 PM
  • Joined: 22 Nov 2011

Gui, Margin, 0, 0...


This doesn't seem the same as having a submit button, because the "gSubmit" is executed every time I change the contents of the edit field, not just when I hit enter...

Turning enter into a context-depentend hotkey might work, but if there's a possibility to get away without that, I'd still be interested.

Odlanir
  • Members
  • 775 posts
  • Last active: Mar 06 2014 11:02 AM
  • Joined: 07 Aug 2011
gui, add, button, [color=red]w0 h0[/color] hidden default gGo

Win7 - Firefox 10.0.2 - AHK_L 1.1.07.00
Please bear with me and my English which is so bad at times that even I don't understand myself

  • Guests
  • Last active:
  • Joined: --
[b]Odlanir[b]'s solution works for zero margins. If you still want margins, but don't want a hidden button to effect autosizing, use
Gui, Add, Button, [color=red]x0 y0[/color] w0 h0 hidden default ggo, &next

You can do hidden tab controls this way too, but you can't use the 'hidden' option as that would hide all the controls inside the tab (use "-Tabstop" instead of "hidden").

Matt123
  • Members
  • 6 posts
  • Last active: Feb 12 2012 02:10 PM
  • Joined: 22 Nov 2011
Thanks, Guest, this is exactly what I was looking for!