Jump to content

control set data


Valuater
 Share

Recommended Posts

ok...

i would like the guictrlsetdata() to append the data to the END of the editbox. if the user places the curser anywhere on the editbox the data is set to that location and not appended to the end of the editbox

i also noted that guictrlsetdata( control id, data, default)

the default seems to have minimal purpose as noted in this example

#include <GUIConstants.au3>

GUICreate("my GUI", 400, 375, -1, -1)
  
    
  ; create send text 
   $send_box = GUICtrlCreateEdit("Type your text here", 10, 260, 300, 60, BitOR($WS_VSCROLL,$ES_AUTOVSCROLL)) 
   $send_button = GUICtrlCreateButton("S&end", 320, 270, 70, 30) 
   $_simple = GUICtrlCreateEdit("Your last text" & @CRLF, 15, 40, 370, 215, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_MULTILINE, $ES_READONLY)) 
    
   GUISetState() 
   
   While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $GUI_EVENT_CLOSE 
            ExitLoop
            
        Case $msg = $send_button
            $send_info = GUICtrlRead($send_box) 
            $x = random(1,10,1)
            GUICtrlSetData($_simple, @CRLF & $send_info & "  " & $x, $x) 
    EndSelect

Wend
exit

any ideas????

thx

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Below is what I would do to get everything set up how you want it.

$oldData = GUICtrlRead($eBox)
GUICtrlSetData($eBox, "")
$Data = $oldData & @CRLF & $newData
GUICtrlSetData($eBox, $Data)

Something along those lines. I am not sure this will be a good idea after the text gets to be too long. This is just a work around. Not a very good one, but atleast clean. I will check the Auto ITS project page to see if I can offer a different solution there. I have seen a similar problem in C++ and VB games I have played.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

good idea.... that might work

thanks

8)

Also set the one edit to disabled to not allow users to select text might be an option. Then you could allow them to select text only when they goto a certain menu. This I would consider a bad work-around.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Also set the one edit to disabled to not allow users to select text might be an option. Then you could allow them to select text only when they goto a certain menu. This I would consider a bad work-around.

JS

i tried that... it disables the scroll also

guess thats not going to work

thx

8)

NEWHeader1.png

Link to comment
Share on other sites

i tried that... it disables the scroll also

guess thats not going to work

thx

8)

Hrm, I will look into a couple other ways of accomplishing this. I am assuming this is for the Auto ITS project. B)

How bad is the first solution I offered for speed when there are large amounts of text?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Hrm... I just checked out the $ES_READONLY, and it seems that should cover your bases, but I notice you have already thought of this by adding that into your box.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Hrm, I will look into a couple other ways of accomplishing this. I am assuming this is for the Auto ITS project. B)

How bad is the first solution I offered for speed when there are large amounts of text?

JS

Yes.. its for the ITS program

the difficulty with the original idea is that there are two "chat windows" and two send buttons ( one is for PM )thus, i am not sure how to approach testing...

$send_info = GUICtrlRead($send_box) 
    If $send_info <> "" And $connected = 1 Then 
        $Text = "~pm-" & $select_name & "-" & $send_info
        SendMessage($Text)
        If GUICtrlGetState($_simple) = $GUI_ACTIVE then
            $old = GUICtrlRead($_simple)
        Else
            $old = GUICtrlRead($child2_view)
        EndIf
        GUICtrlSetData($_simple, $old & @CRLF & $Text) 
        GUICtrlSetData($child2_view, $old & @CRLF & $Text) 
        GUICtrlSetData($send_box, "")
    EndIf

thats the best i can come up with

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Hrm... I would say the PM and Chat should be the same box. I know in command driven games you just type something along the lines of /tell name something about what you want to say. Then press enter.

Having multiple boxes and buttons to me is a little redundant. You could even have an option box on the side that would allow you to decide which way its supposed to be.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Hrm... I would say the PM and Chat should be the same box. I know in command driven games you just type something along the lines of /tell name something about what you want to say. Then press enter.

Having multiple boxes and buttons to me is a little redundant. You could even have an option box on the side that would allow you to decide which way its supposed to be.

JS

one is on the gui the other is on a tab

and there is a button that you can choose which view you want..

trying to see which button was pressed would be more confusing

8)

NEWHeader1.png

Link to comment
Share on other sites

one is on the gui the other is on a tab

and there is a button that you can choose which view you want..

trying to see which button was pressed would be more confusing

8)

Gotcha hrm...

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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