Jump to content

Gui Form docking not working right?


DaRkf0x
 Share

Recommended Posts

Hello :graduated:

I'm making a GUI with Koda and so far so good but I have one problem, when _I run it, the gui isn't docked where I told it to..

This is the code generated by Koda:

#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

if _Singleton("Car Town Bot",1) = 0 Then
    Msgbox(0,"Warning","*** **** *** is already running!")
    Exit
EndIf

Opt("GUIOnEventMode", 1)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
Opt("GUIResizeMode", $GUI_DOCKRIGHT+$GUI_DOCKTOP)
#Region ### START GUI section ###
$Form1 = GUICreate("************t! v 2.5b", 448, 100, 0, 0)
$MenuItem1 = GUICtrlCreateMenu("&Main")
$MenuItem2 = GUICtrlCreateMenuItem("Startup", $MenuItem1)
GUICtrlSetOnEvent(-1, "Startup")
$MenuItem3 = GUICtrlCreateMenuItem("Exit F10", $MenuItem1)
GUICtrlSetOnEvent(-1, "_Terminate")
$MenuItem4 = GUICtrlCreateMenu("&Jobs")
$MenuItem6 = GUICtrlCreateMenuItem("***********e F6", $MenuItem4)
GUICtrlSetOnEvent(-1, "JobDice")
$MenuItem7 = GUICtrlCreateMenuItem("************ F7", $MenuItem4)
GUICtrlSetOnEvent(-1, "JobOil")
$MenuItem5 = GUICtrlCreateMenu("&*****e F8")
GUICtrlSetOnEvent(-1, "**********")
$MenuItem8 = GUICtrlCreateMenu("&Pause F9"&@TAB&"F9")
GUICtrlSetOnEvent(-1, "_Pause")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")
$Progress1 = GUICtrlCreateProgress(112, 24, 329, 33)
$Label1 = GUICtrlCreateLabel("Progress:", 112, 0, 48, 17)
$Label2 = GUICtrlCreateLabel("Status :", 0, 0, 40, 17)
$Label3 = GUICtrlCreateLabel(" Stand By.", 0, 24, 100, 33)
GUICtrlSetFont(-1, 12, 800, 0, "Comic Sans MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFF0000)
Dim $Form1_AccelTable[1][2] = [["{F9}", $MenuItem8]]
GUISetAccelerators($Form1_AccelTable)
GUISetState(@SW_SHOW)
#EndRegion ### END GUI section ###

What exactly am I doing wrong here?

EDIT: it was supposed to be docked in the top right corner of the screen, and it starts in the top left, and about 5pixels off the screen, that is, not even docked anywhere I think. . .

EDIT2: Nevermind, ended up setting the form position by hand, even if it isn't fixed.

Edited by DaRkf0x
Link to comment
Share on other sites

  • Moderators

DaRkf0x,

What exactly am I doing wrong here?

Opt("GUIResizeMode") works on the controls within the GUI, not the GUI itself. As you discovered, you can only locate the GUI by using the location parameters in GUICreate or by a subsequent WinMove. :graduated:

To help you locate the right and bottom corners of the screen when positioning your GUI, remember that AutoIt gives you the @DesktopWidth and @DesktopHeight macros. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

DaRkf0x,

how do I make it fixed in that position, so as one cannot move it anywhere?

Easy! :(

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Const $SC_MOVE = 0xF010

$hGUI_Move  = GUICreate("Movable GUI", 500, 500, 100, 100)
GUISetState()

$hGUI_Static = GUICreate("Immovable GUI", 500, 500, 200, 200)
GUISetState()

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
    If $hWnd = $hGUI_Static Then
        If BitAND($wParam, 0x0000FFF0) = $SC_MOVE Then Return False
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc

When you know how! :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...