 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Sun May 25, 2008 8:19 pm Post subject: Option descriptions as text |
|
|
Could I trouble someone to please assist me in trying to get the following Option descriptions to appear as text in the Title area.
For example: when selecting Option 1 - it should display this in the title, when selecting Option 2, this should then be displayed in the title instead.
My code: | Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Gui, +AlwaysOnTop
Gui, Font, S8 CDefault, Verdana
Gui, Add, GroupBox, x26 y77 w420 h90 , Please Select...
Gui, Add, Radio, x36 y97 w160 h20 +Checked vO1, Option 1 ;Description to appear in title area
Gui, Add, Radio, x36 y117 w160 h20 vO2, Option 2 ;Description to appear in title area
Gui, Add, Radio, x36 y137 w160 h20 vO3, Option 3 ;Description to appear in title area
Gui, Add, Radio, x266 y97 w160 h20 vO4, Option 4 ;Description to appear in title area
Gui, Add, Radio, x266 y117 w160 h20 vO5, Option 5 ;Description to appear in title area
Gui, Add, Radio, x266 y137 w160 h20 vO6, Option 6 ;Description to appear in title area
Gui, Add, GroupBox, x16 y177 w440 h50 , Title
Gui, Font, S12 Bold CBlue, Verdana
Gui, Add, Text, x30 y193 w400 h30 +Center , %O1% ;The Option descriptions should appear here.
Gui, Font, S8 Normal CDefault, Verdana
GuiWidth = 510
Xpos :=A_ScreenWidth - GuiWidth
Gui Show, x%Xpos% yCenter h240 w483,
Return
GuiExit:
GuiClose:
ExitApp |
Thank you |
|
| Back to top |
|
 |
Guest
|
Posted: Mon May 26, 2008 12:10 am Post subject: |
|
|
RTFM -
please look up "g-label" and "Gui, Show" |
|
| Back to top |
|
 |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Mon May 26, 2008 12:24 pm Post subject: |
|
|
I’m obviously pretty stupid as I still can’t get it to work.
I’m not a programmer and I’m still finding it hard to figure out what goes where, but this is what I think should work reading the help file, but it doesn’t
| Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Gui, +AlwaysOnTop
Gui, Font, S8 CDefault, Verdana
Gui, Add, GroupBox, x26 y77 w420 h90 , Please Select...
Gui, Add, Radio, x36 y97 w160 h20 +Checked vOp1 gOp1 , Option 1
Gui, Add, Radio, x36 y117 w160 h20 , Option 2
Gui, Add, Radio, x36 y137 w160 h20 , Option 3
Gui, Add, Radio, x266 y97 w160 h20 , Option 4
Gui, Add, Radio, x266 y117 w160 h20 , Option 5
Gui, Add, Radio, x266 y137 w160 h20 , Option 6
Gui, Add, GroupBox, x16 y177 w440 h50, Title
Gui, Font, S12 Bold CBlue, Verdana
Gui, Add, Text, x30 y193 w400 h30 +Center vMyTitle,
Gui, Font, S8 Normal CDefault, Verdana
GuiWidth = 510
Xpos :=A_ScreenWidth - GuiWidth
Gui Show, x%Xpos% yCenter h240 w483,
Return
Op1:
GuiControlGet,MyTitle,,Op1,Text
GuiControl, Show%MyTitle%, Op1
Return
GuiExit:
GuiClose:
ExitApp |
I'm just trying to get option 1 text to show, then I might stand half a chance at getting the rest. |
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Mon May 26, 2008 2:15 pm Post subject: |
|
|
Not entirely sure what you want, but if you select option 2 and then option 1 again you will see '1' appear in blue in the Title area
| Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Gui, +AlwaysOnTop
Gui, Font, S8 CDefault, Verdana
Gui, Add, GroupBox, x26 y77 w420 h90 , Please Select...
Gui, Add, Radio, x36 y97 w160 h20 +Checked vOp1 gOp1 , Option 1
Gui, Add, Radio, x36 y117 w160 h20 , Option 2
Gui, Add, Radio, x36 y137 w160 h20 , Option 3
Gui, Add, Radio, x266 y97 w160 h20 , Option 4
Gui, Add, Radio, x266 y117 w160 h20 , Option 5
Gui, Add, Radio, x266 y137 w160 h20 , Option 6
Gui, Add, GroupBox, x16 y177 w440 h50, Title
Gui, Font, S12 Bold CBlue, Verdana
Gui, Add, Text, x30 y193 w400 h30 +Center vMyTitle,
Gui, Font, S8 Normal CDefault, Verdana
GuiWidth = 510
Xpos :=A_ScreenWidth - GuiWidth
Gui Show, x%Xpos% yCenter h240 w483,
Return
Op1:
Gui, Submit, NoHide
GuiControl,, MyTitle, %Op1%
Return
GuiExit:
GuiClose:
ExitApp |
Edit: OK, read your question again, you want the TEXT from the radio
button to appear. You could use a global variable as shown below. I'm
note sure if you can get the text from a radio control, it gets the value
either 0 or 1 as far as I know.
| Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Op1Text=Option 1
Gui, +AlwaysOnTop
Gui, Font, S8 CDefault, Verdana
Gui, Add, GroupBox, x26 y77 w420 h90 , Please Select...
Gui, Add, Radio, x36 y97 w160 h20 +Checked vOp1 gOp1, %Op1Text%
Gui, Add, Radio, x36 y117 w160 h20 , Option 2
Gui, Add, Radio, x36 y137 w160 h20 , Option 3
Gui, Add, Radio, x266 y97 w160 h20 , Option 4
Gui, Add, Radio, x266 y117 w160 h20 , Option 5
Gui, Add, Radio, x266 y137 w160 h20 , Option 6
Gui, Add, GroupBox, x16 y177 w440 h50, Title
Gui, Font, S12 Bold CBlue, Verdana
Gui, Add, Text, x30 y193 w400 h30 +Center vMyTitle,
Gui, Font, S8 Normal CDefault, Verdana
GuiWidth = 510
Xpos :=A_ScreenWidth - GuiWidth
Gui Show, x%Xpos% yCenter h240 w483,
Return
Op1:
Gui, Submit, NoHide
GuiControl,, MyTitle, %Op1% - %Op1Text%
Return
GuiExit:
GuiClose:
ExitApp |
|
|
| Back to top |
|
 |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Mon May 26, 2008 3:52 pm Post subject: |
|
|
Thank you
Your assistance provided me with the support I needed to get it working.
Final Working Code:
| Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Gui, +AlwaysOnTop
Gui, Font, S8 CDefault, Verdana
Gui, Add, GroupBox, x26 y77 w420 h90 , Please Select...
Gui, Add, Radio, x36 y97 w160 h20 +Checked vOp1 gOp1 , Option 1
Gui, Add, Radio, x36 y117 w160 h20 vOp2 gOp2 , Option 2
Gui, Add, Radio, x36 y137 w160 h20 vOp3 gOp3 , Option 3
Gui, Add, Radio, x266 y97 w160 h20 vOp4 gOp4 , Option 4
Gui, Add, Radio, x266 y117 w160 h20 vOp5 gOp5 , Option 5
Gui, Add, Radio, x266 y137 w160 h20 vOp6 gOp6 , Option 6
Gui, Add, GroupBox, x16 y177 w440 h50, Title
Gui, Font, S12 Bold CBlue, Verdana
Gui, Add, Text, x30 y193 w400 h30 +Center vMyTitle, Options 1
Gui, Font, S8 Normal CDefault, Verdana
GuiWidth = 510
Xpos :=A_ScreenWidth - GuiWidth
Gui Show, x%Xpos% yCenter h240 w483,
Return
Op1:
Gui, Submit, NoHide
GuiControlGet,Op1,,,Text
GuiControl, , MyTitle, %Op1%
return
Op2:
Gui, Submit, NoHide
GuiControlGet,Op2,,,Text
GuiControl, ,MyTitle, %Op2%
Return
Op3:
Gui, Submit, NoHide
GuiControlGet,Op3,,,Text
GuiControl, ,MyTitle, %Op3%
Return
Op4:
Gui, Submit, NoHide
GuiControlGet,Op4,,,Text
GuiControl, ,MyTitle, %Op4%
Return
Op5:
Gui, Submit, NoHide
GuiControlGet,Op5,,,Text
GuiControl, ,MyTitle, %Op5%
Return
Op6:
Gui, Submit, NoHide
GuiControlGet,Op6,,,Text
GuiControl, ,MyTitle, %Op6%
Return
GuiExit:
GuiClose:
ExitApp |
I'm sure it can be improved upon, but it works and that is what matters to me.
Thank you again for you support. |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon May 26, 2008 5:42 pm Post subject: |
|
|
| Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
Gui, +AlwaysOnTop
Gui, Font, S8 CDefault, Verdana
Gui, Add, GroupBox, x26 y77 w420 h90 , Please Select...
Gui, Add, Radio, x36 y97 w160 h20 +Checked vOp1 gGetOpt , Option 1
Gui, Add, Radio, x36 y117 w160 h20 vOp2 gGetOpt , Option 2
Gui, Add, Radio, x36 y137 w160 h20 vOp3 gGetOpt , Option 3
Gui, Add, Radio, x266 y97 w160 h20 vOp4 gGetOpt , Option 4
Gui, Add, Radio, x266 y117 w160 h20 vOp5 gGetOpt , Option 5
Gui, Add, Radio, x266 y137 w160 h20 vOp6 gGetOpt , Option 6
Gui, Add, GroupBox, x16 y177 w440 h50, Title
Gui, Font, S12 Bold CBlue, Verdana
Gui, Add, Text, x30 y193 w400 h30 +Center vMyTitle, Options 1
Gui, Font, S8 Normal CDefault, Verdana
GuiWidth = 510
Xpos :=A_ScreenWidth - GuiWidth
Gui Show, x%Xpos% yCenter h240 w483,
Return
GetOpt:
Gui, Submit, NoHide
Loop ; go thru all variables of your options
{
If (Op%A_Index%) ; if the variable is 1 (true), it is selected
{
GuiControlGet,% (Op%A_Index%),,,Text
GuiControl, , MyTitle, % (Op%A_Index%)
}
}
return
GuiExit:
GuiClose:
ExitApp |
not tested... |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|