Jump to content
Sign in to follow this  
datkewlguy

tcp gui over internet

Recommended Posts

datkewlguy

Posted this in gui support, perhaps it will get more action here...

"Not sure if this has actually been solved or not, if it hasn't we'll release it once its fully finished. However, the problem is that the GUI that updates the messages in the 'chatroom' between the people over the internet doesnt scroll. Everytime a new message is sent, the control scrolls back up to the top...this can get very annoying... We know how to do this in VB: Text1.SelStart, but cannot find an equal autoit function. Any ideas? Thanks...

Edit: almost forgot, im using an edit control to view the text sent back and forth..."

Share this post


Link to post
Share on other sites
jpm

Posted this in gui support, perhaps it will get more action here...

"Not sure if this has actually been solved or not, if it hasn't we'll release it once its fully finished. However, the problem is that the GUI that updates the messages in the 'chatroom' between the people over the internet doesnt scroll. Everytime a new message is sent, the control scrolls back up to the top...this can get very annoying... We know how to do this in VB: Text1.SelStart, but cannot find an equal autoit function. Any ideas? Thanks...

Edit: almost forgot, im using an edit control to view the text sent back and forth..."

<{POST_SNAPBACK}>

You need to use GuiCtrlSendMsg with the right code. Have a look to standard UDF about GUIedit : _GUICtrlEditSetSel :whistle:

Share this post


Link to post
Share on other sites
GaryFrost

not sure that is the function needed for this operation, more like you would need a line count then scroll line count - 1 i believe

if it is an autoit gui you could use the beta functions, if not here's an example with the 2 functions i believe you'll need to make it work with a gui example, these functions should work with standard edit controls.

#include <GUIConstants.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $h_control, $GUI, $lines, $button

$GUI = GUICreate("Edit Scroll", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
$h_control = ControlGetHandle($GUI, "", $myedit)
GUICtrlSetLimit($myedit, 1500)
$button = GUICtrlCreateButton("Scroll", 300, 160, 90, 25)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
        "5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()
$lines = _GUICtrlEditGetLineCount ($h_control)
GUICtrlSetData($Status, "Line Count: " & $lines)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            _GUICtrlEditLineScroll($h_control, 0, $lines - 1)
    EndSelect
WEnd

Func _GUICtrlEditGetLineCount($h_control)
    Const $EM_GETLINECOUNT = 0xBA
    Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_control, "int", $EM_GETLINECOUNT, "int", 0, "int", 0)
    Return $a_ret[0]
EndFunc  ;==>_GUICtrlEditGetLineCount

Func _GUICtrlEditLineScroll($h_control, $i_horiz, $i_vert)
    Const $EM_LINESCROLL = 0xB6
    Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_control, "int", $EM_LINESCROLL, "int", $i_horiz, "int", $i_vert)
    Return $a_ret[0]
EndFunc  ;==>_GUICtrlEditLineScroll

Gary


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.