Jump to content
Sign in to follow this  
Particle

Controls Flickering :(

Recommended Posts

Particle

I'm workin' on a little trading program for a game and added a nifty control resizing feature using the slider. When you use the slider, the edit and listview controls flicker upon moving. I've searched the forums and tried multiple possibilities, so far no good answer. Anyone want to give it a shot?

#include <Misc.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <GuiSlider.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>

Global $channel = ""
Global $UserCount = 0
Global $Name = "form"

$gui = GUICreate($Name, 418, 570, -1, -1)
$MenuItem1 = GUICtrlCreateMenu("Advanced")
$MenuItem2 = GUICtrlCreateMenuItem("Create Contract", $MenuItem1)
$reg = GUICtrlCreateMenuItem("Register", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Update...", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Credits", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenu("Commands")
$MenuItem7 = GUICtrlCreateMenuItem("Friends", $MenuItem6)
$MenuItem8 = GUICtrlCreateMenuItem("Join", $MenuItem6)
$MenuItem9 = GUICtrlCreateMenuItem("Whisper", $MenuItem6)
$MenuItem10 = GUICtrlCreateMenuItem("Whois", $MenuItem6)
$MenuItem11 = GUICtrlCreateMenuItem("Kick", $MenuItem6)
$MenuItem12 = GUICtrlCreateMenuItem("Ban", $MenuItem6)
$MenuItem13 = GUICtrlCreateMenuItem("Unban", $MenuItem6)
GUISetBkColor(0x000000)
$c_edit = GUICtrlCreateEdit("", 32, 0, 273, 360, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, time() & "Welcome to Trading Pub!" & @CRLF)
GUICtrlSetFont(-1, 7, 400, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Slider1 = GUICtrlCreateSlider(8, -5, 22, 510, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_NOTICKS))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetData(-1, 73)
GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL")
$ListView = GUICtrlCreateListView("Users (" & $UserCount & ")", 312, 64, 98, 438, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
$ListView2 = GUICtrlCreateListView("Contract|Username|Time Left", 32, 360, 273, 142, $LVS_SINGLESEL, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 75)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 94)
GUICtrlSetBkColor(-1, 0x000000)
$c_send = GUICtrlCreateInput("Type here...", 32, 506, 274, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console")
GUICtrlSetColor(-1, "0xe1cec1")
GUICtrlSetBkColor(-1, 0x000000)
$b_Connect = GUICtrlCreateButton("Connect", 312, 2, 99, 25, $WS_GROUP)
$b_settings = GUICtrlCreateButton("Settings", 312, 32, 99, 25, $WS_GROUP)
$b_Send = GUICtrlCreateButton("Send", 310, 506, 99, 17, $WS_GROUP)
$StatusBar1 = _GUICtrlStatusBar_Create($gui)
Dim $StatusBar1_PartsWidth[3] = [181, 331, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "Status: Disconnected", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "Broadcast: Idle", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "Ping: 0ms", 2)
GUISetState(@SW_SHOW, $gui)

While 1
    Sleep(1)
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_HVSCROLL($hWndGUI, $MsgID, $WParam, $LParam)
    Switch $LParam
        Case GUICtrlGetHandle($Slider1)
            Local $NewEdit1Height = (_GUICtrlSlider_GetPos($Slider1) / 100) * 504
            Local $NewListViewHeight = $NewEdit1Height - 504
            GUICtrlSetPos($c_edit, 32, 0, 273, $NewEdit1Height)
            GUICtrlSetPos($ListView2, 32, $NewEdit1Height, 273, 504 - $NewEdit1Height)
            If _GUICtrlSlider_GetPos($Slider1) = 100 Then
                GUICtrlSetState($ListView2, $GUI_HIDE)
            ElseIf _GUICtrlSlider_GetPos($Slider1) = 0 Then
                GUICtrlSetState($c_edit, $GUI_HIDE)
            ElseIf _GUICtrlSlider_GetPos($Slider1) <> 100 Or _GUICtrlSlider_GetPos($Slider1) <> 0 Then
                GUICtrlSetState($ListView2, $GUI_SHOW)
                GUICtrlSetState($c_edit, $GUI_SHOW)
            EndIf
    EndSwitch
EndFunc  ;==>WM_HVSCROLL

Func time()
    Return "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] "
EndFunc  ;==>time

Share this post


Link to post
Share on other sites
martin

I'm workin' on a little trading program for a game and added a nifty control resizing feature using the slider. When you use the slider, the edit and listview controls flicker upon moving. I've searched the forums and tried multiple possibilities, so far no good answer. Anyone want to give it a shot?

#include <Misc.au3>
 #include <GuiListView.au3>
 #include <ButtonConstants.au3>
 #include <EditConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <GuiStatusBar.au3>
 #include <ListViewConstants.au3>
 #include <SliderConstants.au3>
 #include <WindowsConstants.au3>
 #include <GuiEdit.au3>
 #include <GuiSlider.au3>
 #include <WinAPI.au3>
 #include <SendMessage.au3>
 
 Global $channel = ""
 Global $UserCount = 0
 Global $Name = "form"
 
 $gui = GUICreate($Name, 418, 570, -1, -1)
 $MenuItem1 = GUICtrlCreateMenu("Advanced")
 $MenuItem2 = GUICtrlCreateMenuItem("Create Contract", $MenuItem1)
 $reg = GUICtrlCreateMenuItem("Register", $MenuItem1)
 $MenuItem3 = GUICtrlCreateMenuItem("Update...", $MenuItem1)
 $MenuItem4 = GUICtrlCreateMenuItem("Credits", $MenuItem1)
 $MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
 $MenuItem6 = GUICtrlCreateMenu("Commands")
 $MenuItem7 = GUICtrlCreateMenuItem("Friends", $MenuItem6)
 $MenuItem8 = GUICtrlCreateMenuItem("Join", $MenuItem6)
 $MenuItem9 = GUICtrlCreateMenuItem("Whisper", $MenuItem6)
 $MenuItem10 = GUICtrlCreateMenuItem("Whois", $MenuItem6)
 $MenuItem11 = GUICtrlCreateMenuItem("Kick", $MenuItem6)
 $MenuItem12 = GUICtrlCreateMenuItem("Ban", $MenuItem6)
 $MenuItem13 = GUICtrlCreateMenuItem("Unban", $MenuItem6)
 GUISetBkColor(0x000000)
 $c_edit = GUICtrlCreateEdit("", 32, 0, 273, 360, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
 GUICtrlSetData(-1, time() & "Welcome to Trading Pub!" & @CRLF)
 GUICtrlSetFont(-1, 7, 400, 0, "Lucida Console")
 GUICtrlSetColor(-1, 0xFFFFFF)
 GUICtrlSetBkColor(-1, 0x000000)
 $Slider1 = GUICtrlCreateSlider(8, -5, 22, 510, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_NOTICKS))
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetData(-1, 73)
 GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL")
 $ListView = GUICtrlCreateListView("Users (" & $UserCount & ")", 312, 64, 98, 438, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES))
 GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
 $ListView2 = GUICtrlCreateListView("Contract|Username|Time Left", 32, 360, 273, 142, $LVS_SINGLESEL, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
 GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
 GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 75)
 GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 94)
 GUICtrlSetBkColor(-1, 0x000000)
 $c_send = GUICtrlCreateInput("Type here...", 32, 506, 274, 19)
 GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console")
 GUICtrlSetColor(-1, "0xe1cec1")
 GUICtrlSetBkColor(-1, 0x000000)
 $b_Connect = GUICtrlCreateButton("Connect", 312, 2, 99, 25, $WS_GROUP)
 $b_settings = GUICtrlCreateButton("Settings", 312, 32, 99, 25, $WS_GROUP)
 $b_Send = GUICtrlCreateButton("Send", 310, 506, 99, 17, $WS_GROUP)
 $StatusBar1 = _GUICtrlStatusBar_Create($gui)
 Dim $StatusBar1_PartsWidth[3] = [181, 331, -1]
 _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
 _GUICtrlStatusBar_SetText($StatusBar1, "Status: Disconnected", 0)
 _GUICtrlStatusBar_SetText($StatusBar1, "Broadcast: Idle", 1)
 _GUICtrlStatusBar_SetText($StatusBar1, "Ping: 0ms", 2)
 GUISetState(@SW_SHOW, $gui)
 
 While 1
     Sleep(1)
     $msg = GUIGetMsg()
     Switch $msg
         Case $GUI_EVENT_CLOSE
             Exit
     EndSwitch
 WEnd
 
 Func WM_HVSCROLL($hWndGUI, $MsgID, $WParam, $LParam)
     Switch $LParam
         Case GUICtrlGetHandle($Slider1)
             Local $NewEdit1Height = (_GUICtrlSlider_GetPos($Slider1) / 100) * 504
             Local $NewListViewHeight = $NewEdit1Height - 504
             GUICtrlSetPos($c_edit, 32, 0, 273, $NewEdit1Height)
             GUICtrlSetPos($ListView2, 32, $NewEdit1Height, 273, 504 - $NewEdit1Height)
             If _GUICtrlSlider_GetPos($Slider1) = 100 Then
                 GUICtrlSetState($ListView2, $GUI_HIDE)
             ElseIf _GUICtrlSlider_GetPos($Slider1) = 0 Then
                 GUICtrlSetState($c_edit, $GUI_HIDE)
             ElseIf _GUICtrlSlider_GetPos($Slider1) <> 100 Or _GUICtrlSlider_GetPos($Slider1) <> 0 Then
                 GUICtrlSetState($ListView2, $GUI_SHOW)
                 GUICtrlSetState($c_edit, $GUI_SHOW)
             EndIf
     EndSwitch
 EndFunc ;==>WM_HVSCROLL
 
 Func time()
     Return "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] "
 EndFunc ;==>time
This improves it a lot for me.

#include <Misc.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <GuiSlider.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>
Global $hidden = False
Global $channel = ""
Global $UserCount = 0
Global $Name = "form"

Const $WM_ENTERSIZEMOVE = 0x0231,$WM_EXITSIZEMOVE = 0x0232
$gui = GUICreate($Name, 418, 570, -1, -1,-1)
$MenuItem1 = GUICtrlCreateMenu("Advanced")
$MenuItem2 = GUICtrlCreateMenuItem("Create Contract", $MenuItem1)
$reg = GUICtrlCreateMenuItem("Register", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Update...", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Credits", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenu("Commands")
$MenuItem7 = GUICtrlCreateMenuItem("Friends", $MenuItem6)
$MenuItem8 = GUICtrlCreateMenuItem("Join", $MenuItem6)
$MenuItem9 = GUICtrlCreateMenuItem("Whisper", $MenuItem6)
$MenuItem10 = GUICtrlCreateMenuItem("Whois", $MenuItem6)
$MenuItem11 = GUICtrlCreateMenuItem("Kick", $MenuItem6)
$MenuItem12 = GUICtrlCreateMenuItem("Ban", $MenuItem6)
$MenuItem13 = GUICtrlCreateMenuItem("Unban", $MenuItem6)
GUISetBkColor(0x000000)
$c_edit = GUICtrlCreateEdit("", 32, 0, 273, 360, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, time() & "Welcome to Trading Pub!" & @CRLF)
GUICtrlSetFont(-1, 7, 400, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Slider1 = GUICtrlCreateSlider(8, -5, 22, 510, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_NOTICKS))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetData(-1, 73)
GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL")
GUIRegisterMsg($WM_ENTERSIZEMOVE,"EnterSM")
GUIRegisterMsg($WM_EXITSIZEMOVE,"ExitSM")
$ListView = GUICtrlCreateListView("Users (" & $UserCount & ")", 312, 64, 98, 438, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
$ListView2 = GUICtrlCreateListView("Contract|Username|Time Left", 32, 360, 273, 142, $LVS_SINGLESEL, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 75)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 94)
GUICtrlSetBkColor(-1, 0x000000)
$c_send = GUICtrlCreateInput("Type here...", 32, 506, 274, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console")
GUICtrlSetColor(-1, "0xe1cec1")
GUICtrlSetBkColor(-1, 0x000000)
$b_Connect = GUICtrlCreateButton("Connect", 312, 2, 99, 25, $WS_GROUP)
$b_settings = GUICtrlCreateButton("Settings", 312, 32, 99, 25, $WS_GROUP)
$b_Send = GUICtrlCreateButton("Send", 310, 506, 99, 17, $WS_GROUP)
$StatusBar1 = _GUICtrlStatusBar_Create($gui)
Dim $StatusBar1_PartsWidth[3] = [181, 331, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "Status: Disconnected", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "Broadcast: Idle", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "Ping: 0ms", 2)
GUISetState(@SW_SHOW, $gui)

While 1
    Sleep(1)
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    if _IsPressed(1) Then
        $mp = GUIGetCursorInfo()
        if $mp[4] = $slider1 Then
            EnterSM()
            while _IsPressed(1)
                sleep(20)
            WEnd
            ExitSM()
        EndIf
    EndIf

WEnd

Func WM_HVSCROLL($hWndGUI, $MsgID, $WParam, $LParam)
    Switch $LParam
        Case GUICtrlGetHandle($Slider1)
            Local $NewEdit1Height = (_GUICtrlSlider_GetPos($Slider1) / 100) * 504
            Local $NewListViewHeight = $NewEdit1Height - 504
            GUICtrlSetPos($c_edit, 32, 0, 273, $NewEdit1Height)
            GUICtrlSetPos($ListView2, 32, $NewEdit1Height, 273, 504 - $NewEdit1Height)
            If _GUICtrlSlider_GetPos($Slider1) = 100 Then
                GUICtrlSetState($ListView2, $GUI_HIDE)
                $hidden = True
            ElseIf _GUICtrlSlider_GetPos($Slider1) = 0 Then
                GUICtrlSetState($c_edit, $GUI_HIDE)
                $hidden = True
            ElseIf _GUICtrlSlider_GetPos($Slider1) <> 100 Or _GUICtrlSlider_GetPos($Slider1) <> 0 Then
               if $hidden Then
               GUICtrlSetState($ListView2, $GUI_SHOW)
                GUICtrlSetState($c_edit, $GUI_SHOW)
                $hidden = False
                EndIf
            EndIf
    EndSwitch
EndFunc ;==>WM_HVSCROLL

Func time()
    Return "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] "
EndFunc ;==>time


Func EnterSM()
    GUICtrlSetStyle($c_edit,BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN))
EndFunc

func ExitSM()
    GUICtrlSetStyle($c_edit,BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))

EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Particle

Yeah it does improve by a little. If that's the best we can do, I appreciate it. Thanks.

Share this post


Link to post
Share on other sites
onderhold

Yeah it does improve by a little. If that's the best we can do, I appreciate it. Thanks.

Try this, it's almost flicker free:

#include <Misc.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <GuiSlider.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>

Global $channel = ""
Global $UserCount = 0
Global $Name = "form"

$gui = GUICreate($Name, 418, 570, -1, -1)
$MenuItem1 = GUICtrlCreateMenu("Advanced")
$MenuItem2 = GUICtrlCreateMenuItem("Create Contract", $MenuItem1)
$reg = GUICtrlCreateMenuItem("Register", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Update...", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Credits", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenu("Commands")
$MenuItem7 = GUICtrlCreateMenuItem("Friends", $MenuItem6)
$MenuItem8 = GUICtrlCreateMenuItem("Join", $MenuItem6)
$MenuItem9 = GUICtrlCreateMenuItem("Whisper", $MenuItem6)
$MenuItem10 = GUICtrlCreateMenuItem("Whois", $MenuItem6)
$MenuItem11 = GUICtrlCreateMenuItem("Kick", $MenuItem6)
$MenuItem12 = GUICtrlCreateMenuItem("Ban", $MenuItem6)
$MenuItem13 = GUICtrlCreateMenuItem("Unban", $MenuItem6)
GUISetBkColor(0x000000)
$c_edit = GUICtrlCreateEdit("", 32, 0, 273, 360, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, time() & "Welcome to Trading Pub!" & @CRLF)
GUICtrlSetFont(-1, 7, 400, 0, "Lucida Console")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Slider1 = GUICtrlCreateSlider(8, -5, 22, 510, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_NOTICKS))
;~  GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetData(-1, 73)
GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL")

$ListView = GUICtrlCreateListView("Users (" & $UserCount & ")", 312, 64, 98, 438, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)

$ListView2 = GUICtrlCreateListView("Contract|Username|Time Left", 32, 360, 273, 142, $LVS_SINGLESEL, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 75)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 94)
GUICtrlSetBkColor(-1, 0x000000)

$c_send = GUICtrlCreateInput("Type here...", 32, 506, 274, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console")
GUICtrlSetColor(-1, "0xe1cec1")
GUICtrlSetBkColor(-1, 0x000000)

$b_Connect = GUICtrlCreateButton("Connect", 312, 2, 99, 25, $WS_GROUP)
$b_settings = GUICtrlCreateButton("Settings", 312, 32, 99, 25, $WS_GROUP)
$b_Send = GUICtrlCreateButton("Send", 310, 506, 99, 17, $WS_GROUP)
$StatusBar1 = _GUICtrlStatusBar_Create($gui)
Dim $StatusBar1_PartsWidth[3] = [181, 331, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "Status: Disconnected", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "Broadcast: Idle", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "Ping: 0ms", 2)
GUISetState(@SW_SHOW, $gui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    Sleep(50)
WEnd

Func WM_HVSCROLL($hWndGUI, $MsgID, $WParam, $LParam)
    Switch $LParam
        Case GUICtrlGetHandle($Slider1)
            _sendMessage($c_edit, $WM_SETREDRAW, 0)
            _sendMessage($ListView2, $WM_SETREDRAW, 0)
            Local $NewEdit1Height = (_GUICtrlSlider_GetPos($Slider1) / 100) * 504
            Local $NewListViewHeight = $NewEdit1Height - 504
            GUICtrlSetPos($c_edit, 32, 0, 273, $NewEdit1Height)
            GUICtrlSetPos($ListView2, 32, $NewEdit1Height, 273, 504 - $NewEdit1Height)
            If _GUICtrlSlider_GetPos($Slider1) = 100 Then
                GUICtrlSetState($ListView2, $GUI_HIDE)
            ElseIf _GUICtrlSlider_GetPos($Slider1) = 0 Then
                GUICtrlSetState($c_edit, $GUI_HIDE)
            ElseIf _GUICtrlSlider_GetPos($Slider1) <> 100 Or _GUICtrlSlider_GetPos($Slider1) <> 0 Then
                 GUICtrlSetState($ListView2, $GUI_SHOW)
                 GUICtrlSetState($c_edit, $GUI_SHOW)
            EndIf
            _sendMessage($c_edit, $WM_SETREDRAW, 1)
            _sendMessage($ListView2, $WM_SETREDRAW, 1)
            _WinAPI_InvalidateRect($gui, 0, False) ; mark window to be repainted
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HVSCROLL

Func time()
    Return "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] "
EndFunc  ;==>time

Share this post


Link to post
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
Sign in to follow this  

×