 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Invalid User
Joined: 14 Feb 2005 Posts: 447 Location: Texas, Usa
|
Posted: Wed May 04, 2005 4:13 am Post subject: moveable tool bar? |
|
|
can ahk have a moveable toolbar that doesnt use a second window? Yes. Have a look. This may not be of use to more than 10% of ahk users but I am sure this will spark an idea with a few of them
| Code: | ;TB = ToolBar
;TBC = ToolBar Control
#InstallMouseHook
;#### SubMenus ####
;-------------File Menu------------------
Menu, File_Menu_Gui, Add, New Session, NewSession
Menu, File_Menu_Gui, Add, Open Session, OpenExistingSession
Menu, File_Menu_Gui, Add, Import File, ImportDataFile
Menu, File_Menu_Gui, Add, Exit , ExitAppSub
;------------Tools Menu-------------------
Menu, Tools_Menu_Gui, Add, Add New Object, AddNewObject
Menu, Tools_Menu_Gui, Add, Monitor Engine, MonitorEngine
;------------Settings Menu-----------------
Menu, Settings_Menu_Gui, Add, User Preferences, UserPreferences
Menu, Settings_Menu_Gui, Add, Engine Settings, EngineSettings
;----------Edit---------------------------
Menu, Edit_Menu_Gui, Add, Edit Object, EditObject
;#### Menus seen on the Main Gui ####
Menu, MyMenuBar, Add, File, :File_Menu_Gui
Menu, MyMenuBar, Add, Edit, :Edit_Menu_Gui
Menu, MyMenuBar, Add, Tools, :Tools_Menu_Gui
Menu, MyMenuBar, Add, Settings, :Settings_Menu_Gui
;#### Main Gui Interface ####
Gui, Menu, MyMenuBar
Gui, Add, Button, vTBC1 gHideToolBar x186 y5 w15 h15, _
Gui, Add, Button, vTBC2 gMoveToolBar x200 y5 w15 h15, +
Gui, Add, Button, vTBC3 x186 y20 w15 h15, ?
Gui, Add, Button, vTBC4 x200 y20 w15 h15, #
Gui, Add, Button, vTBC5 x6 y5 w80 h30, Edit Object
Gui, Add, Button, vTBC6 x96 y5 w80 h30, Create New Object
Gui, Add, Button, vTBC7 x6 y45 w60 h30, Objects
Gui, Add, Button, vTBC8 x76 y45 w70 h30, Barriers
Gui, Add, Button, vTBC9 x156 y45 w60 h30, Sounds
Gui, Add, Button, vTBC10 x6 y85 w30 h30, <
Gui, Add, Button, vTBC11 x186 y85 w30 h30, >
;Gui, Add, Text, vCONText tl x46 y85 w130 h30, CurrentObjectNumber
;Gui, Add, Text, vHardnessText x6 y125 w170 h20, Hardness
;Gui, Add, Text, vResText x6 y155 w170 h20, Resistance
;Gui, Add, Text, vWidthText x6 y185 w170 h20, Width
;Gui, Add, Text, vLengthText x6 y215 w170 h20, Length
;Gui, Add, Text, vHeightText x6 y245 w170 h20, Height
;Gui, Add, Text, vTextureText x6 y275 w170 h20, Texture
;Gui, Add, Text, vWeightText x6 y305 w170 h20, Weight
;Gui, Add, Text, vDirectText x6 y335 w170 h20, Direction
;Gui, Add, Text, vShapeText x6 y365 w170 h20, Shape
;Gui, Add, Text, vSpeedText x6 y395 w170 h20, Speed
;Gui, Add, Edit, vHardnessEdit x186 y125 w30 h20, HardnessLevel
;Gui, Add, Edit, x186 y155 w30 h20, 1
;Gui, Add, Edit, x186 y185 w30 h20, 2
;Gui, Add, Edit, x186 y215 w30 h20, 3
;Gui, Add, Edit, x186 y245 w30 h20, 4
;Gui, Add, Edit, x186 y275 w30 h20, 5
;Gui, Add, Edit, x186 y305 w30 h20, 6
;Gui, Add, Edit, x186 y335 w30 h20, 7
;Gui, Add, Edit, x186 y365 w30 h20, 8
;Gui, Add, Edit, x186 y395 w30 h20, 9
Gui, Show, x-4 y-4 h461 w640,
Return
;########## SubRoutines ########
;-------------File Menu------------------
NewSession:
OpenExistingSession:
ImportDataFile:
ExitAppSub:
MonitorEngine:
AddNewObject:
UserPreferences:
EngineSettings:
EditObject:
Return
;---------------Gui Functions------------
HideToolBar:
Return
MoveToolBar:
GuiControlGet, TB_Pos_Index, Pos, TBC2
TB_PosX = %TB_Pos_IndexX%
TB_PosY = %TB_Pos_IndexY%
GoSub, GetToolBarControlsPos
GoSub, HideToolBarControls
GuiControl, Hide, TBC1
GuiControl, Hide, TBC3
GuiControl, Hide, TBC4
Loop
{
MouseGetPos, MPosX, MPosY
MposX -= 3
MposY -= 40
GuiControl, Move, TBC2, x%MPosX% y%MPosY%
GetKeyState, LButtonState, LButton, P
If LButtonState = D
Break
}
GuiControlGet, TB_Pos_Index, Pos, TBC2
TB_XDiff := (TB_Pos_IndexX - TB_PosX)
TB_YDiff := (TB_Pos_IndexY - TB_PosY)
GoSub, MoveToolBarControls
GoSub, ShowToolBarControls
GuiControl, Show, TBC1
GuiControl, Show, TBC3
GuiControl, Show, TBC4
Return
MoveToolBarControls:
Ctrl1PosX += %TB_XDiff%
Ctrl2PosX += %TB_XDiff%
Ctrl3PosX += %TB_XDiff%
Ctrl4PosX += %TB_XDiff%
Ctrl5PosX += %TB_XDiff%
Ctrl6PosX += %TB_XDiff%
Ctrl7PosX += %TB_XDiff%
Ctrl8PosX += %TB_XDiff%
Ctrl9PosX += %TB_XDiff%
Ctrl10PosX += %TB_XDiff%
Ctrl11PosX += %TB_XDiff%
Ctrl1PosY += %TB_YDiff%
Ctrl2PosY += %TB_YDiff%
Ctrl3PosY += %TB_YDiff%
Ctrl4PosY += %TB_YDiff%
Ctrl5PosY += %TB_YDiff%
Ctrl6PosY += %TB_YDiff%
Ctrl7PosY += %TB_YDiff%
Ctrl8PosY += %TB_YDiff%
Ctrl9PosY += %TB_YDiff%
Ctrl10PosY += %TB_YDiff%
Ctrl11PosY += %TB_YDiff%
GuiControl, Move, TBC1, x%Ctrl1PosX% y%Ctrl1PosY%
GuiControl, Move, TBC2, x%Ctrl2PosX% y%Ctrl2PosY%
GuiControl, Move, TBC3, x%Ctrl3PosX% y%Ctrl3PosY%
GuiControl, Move, TBC4, x%Ctrl4PosX% y%Ctrl4PosY%
GuiControl, Move, TBC5, x%Ctrl5PosX% y%Ctrl5PosY%
GuiControl, Move, TBC6, x%Ctrl6PosX% y%Ctrl6PosY%
GuiControl, Move, TBC7, x%Ctrl7PosX% y%Ctrl7PosY%
GuiControl, Move, TBC8, x%Ctrl8PosX% y%Ctrl8PosY%
GuiControl, Move, TBC9, x%Ctrl9PosX% y%Ctrl9PosY%
GuiControl, Move, TBC10, x%Ctrl10PosX% y%Ctrl10PosY%
GuiControl, Move, TBC11, x%Ctrl11PosX% y%Ctrl11PosY%
Return
GetToolBarControlsPos:
GuiControlGet, Ctrl1Pos, Pos, TBC1
GuiControlGet, Ctrl2Pos, Pos, TBC2
GuiControlGet, Ctrl3Pos, Pos, TBC3
GuiControlGet, Ctrl4Pos, Pos, TBC4
GuiControlGet, Ctrl5Pos, Pos, TBC5
GuiControlGet, Ctrl6Pos, Pos, TBC6
GuiControlGet, Ctrl7Pos, Pos, TBC7
GuiControlGet, Ctrl8Pos, Pos, TBC8
GuiControlGet, Ctrl9Pos, Pos, TBC9
GuiControlGet, Ctrl10Pos, Pos, TBC10
GuiControlGet, Ctrl11Pos, Pos, TBC11
Return
HideToolBarControls:
;GuiControl, Hide, TBC1
;GuiControl, Hide, TBC2
;GuiControl, Hide, TBC3
;GuiControl, Hide, TBC4
GuiControl, Hide, TBC5
GuiControl, Hide, TBC6
GuiControl, Hide, TBC7
GuiControl, Hide, TBC8
GuiControl, Hide, TBC9
GuiControl, Hide, TBC10
GuiControl, Hide, TBC11
Return
ShowToolBarControls:
;GuiControl, Show, TBC1
;GuiControl, Show, TBC2
;GuiControl, Show, TBC3
;GuiControl, Show, TBC4
GuiControl, Show, TBC5
GuiControl, Show, TBC6
GuiControl, Show, TBC7
GuiControl, Show, TBC8
GuiControl, Show, TBC9
GuiControl, Show, TBC10
GuiControl, Show, TBC11
Return
;#######################################
;########## HOT KEYS ###################
;#######################################
;#### Reload ####
F9::Reload
GuiClose:
ExitApp |
_________________ my lame sig  |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Wed May 04, 2005 3:54 pm Post subject: |
|
|
Very nice!
Could you also show the controls as they are moved, or at least an outline? Sometimes part of them get outside of the GUI window. |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 447 Location: Texas, Usa
|
Posted: Wed May 04, 2005 4:37 pm Post subject: |
|
|
yeah, I was thinking about making a group box as an out line, and I dont show the controls when moving becuase I would loop that function or set a timer and I know the effect that I would get, the button most controls would lag a little bit, so I found it best to just hide them. _________________ my lame sig  |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 447 Location: Texas, Usa
|
Posted: Wed May 04, 2005 4:39 pm Post subject: |
|
|
yeah, I was thinking about making a group box as an out line, and I dont show the controls when moving becuase I would loop that function or set a timer and I know the effect that I would get, the button most controls would lag a little bit, so I found it best to just hide them. Also, I do know that the button can be covered by the menu if you click and drag up there. Or the the very bottom or right of the window. It needs some tweak but I thought it was a nice start. And one thing that Peed me off was that I could find no way to start the event on the buttons down event otherwise it would be a drag and drop style but, I do what I can _________________ my lame sig  |
|
| 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
|