Jump to content

Controls Sized Incorrectly


Kura_Kai
 Share

Recommended Posts

I just created a GUI window but the current problem is that when I run it a List control is sized wrong. But when I change the window size it changes to the way it should be. It seems ackward to me is there anyway I could fix this from the start?

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 460, 260,-1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Edit_1 = GuiCtrlCreateEdit("Edit1", 10, 10, 360, 210)
$Input_2 = GuiCtrlCreateInput("Input2", 10, 230, 360, 20)
$List_3 = GuiCtrlCreateList("List3", 380, 10, 70, 240)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
Link to comment
Share on other sites

  • Moderators

Are you saying it's 10 off on the width?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Nevermind I figured out what was wrong with my programming, didn't have the list setup with the styles. But now I have ran into another problem, you can get lists to notify if it was clicked but the problem is I want it to only notify if it was double clicked and on the string not anywhere on the list. This is the new code I have.

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 460, 260,-1, -1)

$Edit_1 = GuiCtrlCreateEdit("Edit1", 10, 10, 360, 210)
$Input_2 = GuiCtrlCreateInput("Input2", 10, 230, 360, 20)
$List_3 = GuiCtrlCreateList("List3", 380, 10, 70, 240, BitOR($LBS_SORT, $LBS_NOINTEGRALHEIGHT, $LBS_NOTIFY))

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $List_3
        MsgBox(0,"",GUICtrlRead($msg))
    Case Else
        ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

You can see it is set to notify and it makes a message box of what is selected but it pops up no matter where you clicked. Anything I can do for that?

Link to comment
Share on other sites

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

Global Const $DebugIt = 1
Global Const $WM_COMMAND = 0x0111

GuiCreate("MyGUI", 460, 260,-1, -1)

$Edit_1 = GuiCtrlCreateEdit("Edit1", 10, 10, 360, 210)
$Input_2 = GuiCtrlCreateInput("Input2", 10, 230, 360, 20)
$List_3 = GuiCtrlCreateList("List3", 380, 10, 70, 240, BitOR($LBS_SORT, $LBS_NOINTEGRALHEIGHT, $LBS_NOTIFY, $WS_TABSTOP))

GuiSetState()
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Func List_DoubleClick()
    ;----------------------------------------------------------------------------------------------
    If $DebugIt Then    _DebugPrint ("$LBN_DBLCLK: " & GUICtrlRead($List_3))
    ;----------------------------------------------------------------------------------------------
EndFunc   ;==>ListView_DoubleClick

Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = _HiWord($wParam)
    Local $nID = _LoWord($wParam)
    Local $hCtrl = $lParam
    Local Const $LBN_ERRSPACE = (-2);
    Local Const $LBN_SELCHANGE = 1;
    Local Const $LBN_DBLCLK = 2;
    Local Const $LBN_SELCANCEL = 3;
    Local Const $LBN_SETFOCUS = 4;
    Local Const $LBN_KILLFOCUS = 5;

    Switch $nID
        Case $List_3
            Switch $nNotifyCode
                Case $LBN_ERRSPACE
                    _DebugPrint ("$LBN_ERRSPACE")
                Case $LBN_SELCHANGE
                    _DebugPrint ("$LBN_SELCHANGE")
                Case $LBN_SELCANCEL
                    _DebugPrint ("$LBN_SELCANCEL")
                Case $LBN_SETFOCUS
                    _DebugPrint ("$LBN_SETFOCUS")
                Case $LBN_KILLFOCUS
                    _DebugPrint ("$LBN_KILLFOCUS")
                Case $LBN_DBLCLK
                    List_DoubleClick()
            EndSwitch
    EndSwitch
    ; Proceed the default Autoit3 internal message commands.
    ; You also can complete let the line out.
    ; !!! But only 'Return' (without any value) will not proceed
    ; the default Autoit3-message in the future !!!
    Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_COMMAND

Func _DebugPrint($s_text)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+===========================================================" & @LF & _
            "-->" & $s_text & @LF & _
            "+===========================================================" & @LF)
EndFunc   ;==>_DebugPrint

Func _HiWord($x)
    Return BitShift($x, 16)
EndFunc   ;==>_HiWord

Func _LoWord($x)
    Return BitAND($x, 0xFFFF)
EndFunc   ;==>_LoWord

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...