Announcement

Collapse
No announcement yet.

Append Text to Edit control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    Because I wrote that before the compiler supported MACROs, that's why not.

    Leave a comment:


  • Michael Mattias
    replied
    To highlight a listview row .. you select it.

    Code:
    FUNCTION ListView_SetSelection (BYVAL hWnd AS LONG, BYVAL Rowno AS LONG) AS LONG
      ListView_SetItemState hWnd, RowNo, &hFFFFFFFF, (%LVIS_SELECTED OR %LVIS_FOCUSED)
    END FUNCTION
    MCM

    Leave a comment:


  • Scott Turchin
    replied
    Thanks Michael- just created a 2 element LONG array to get it created, and then just keep piling the status on...

    I'm not certain why it kept the top element highlighted so this code was an attempt to put focus on the last element, while it doesn't highlight the last element it does keep it scrolled to the bottom so you can see the last info posted.

    lHost = RemoteIp(ByVal hTcp)
    sTmp = TimeStamp() & " Connection established from: " & lHost
    lResult = SendMessage(BBSDown.txtHandle, %LB_ADDSTRING, 0, StrPtr(sTmp))
    lResult = SendMessage(BBSDown.txtHandle, %LVM_GETITEMCOUNT, 0, 0)
    lResult = SendMessage(BBSDown.txtHandle, %LVM_SETITEM, 0, lResult)

    Leave a comment:


  • Michael Mattias
    replied
    A few little changes and I think this might work for you perfectly:
    Use Listview control as a console. September 13 2003.

    Leave a comment:


  • Kev Peel
    replied
    maybe setting RO (EM_SETREADONLY?) prevents data from being added to the control, there would be a certain logic in that?
    No, the flags such as WS_DISABLED and ES_READONLY only affect the user's ability to change the content of the control.

    Leave a comment:


  • Chris Holbrook
    replied
    Originally posted by Scott Turchin View Post
    I've gotan edit control set and created in read_only mode... what am I missing here?
    maybe setting RO (EM_SETREADONLY?) prevents data from being added to the control, there would be a certain logic in that?

    Why not post some compileable code?

    Leave a comment:


  • Cliff Nichols
    replied
    ok, I am lost
    <code not shown>

    Can you provide an example so we can see how the error is 0? or something else we can see but you can't see?

    Often when its "2+2=5", its really "2+2+<oops>=5"

    Leave a comment:


  • Chris Holbrook
    replied
    Originally posted by Scott Turchin View Post
    ... gotta create a friggin array just to create the listbox...
    surely that kind of friggin is not necessary? Just create the ListBox without supplying the array parameter to CONTROL ADD LISTBOX then add items with LISTBOX ADD?

    Leave a comment:


  • Scott Turchin
    replied
    I don't like it, strange, it's supposed to bring back some text..
    IT is inside of a thread though, not sure if that matters...

    Listbox will work but it's a PITA, gotta create a friggin array just to create the listbox....otherwise it works...

    Leave a comment:


  • Michael Mattias
    replied
    >The error code is zero......that's the weird part...

    The RETURN from WM_GETTEXT = 0? That means "no characters retrieved."

    Kinda means it's working as designed, huh?

    Leave a comment:


  • Scott Turchin
    replied
    Ya forgot about that setsel - the combo box idea is good, it's only getting written TO it, never recovered from it....may go that route, it's just a display to showwho connected...

    But still, one would think this would work.
    '
    THe error code is zero......that's the weird part...

    no prob, combobox it is....

    Leave a comment:


  • Kev Peel
    replied
    See:

    EM_SETSEL
    EM_REPLACESEL

    Leave a comment:


  • Michael Mattias
    replied
    Maybe change to use a combobox or listbox one row per IP address isntead of a multi-line edit control? (you can make combobox read only if you want)

    You are doing a 'new line' for each address anyway.

    ???


    Failing that, what are the error codes from WM_GETTEXT and WM_SETTEXT? (yes they do return success/fail values)


    MCM
    Last edited by Michael Mattias; 16 Oct 2008, 01:28 PM.

    Leave a comment:


  • Scott Turchin
    started a topic Append Text to Edit control

    Append Text to Edit control

    I've gotan edit control set and created in read_only mode...
    I use it to do an on-screen display of IP addresses that have connected.
    Now if I do a Control Get Text to sTmp and append new data to sTmp and control set text BACK all is well.

    I searched but could not find what I was looking for, either there was a SendMessage api that could append text or I need to GET the text and append it.

    However, this is inside of a thread, not a callback - so Control Get Text is out.

    This is not working...Buff isreturned Zero but GETTEXTLENGTH returns 62 bytes on first run (and it is 62 bytes) - so it sees it, what am I missing here?
    I've tried it using a STRINg as well and a StrPtr - no go.

    Code:
    Function AppendTextToWindow(ByVal sPacket As String) As Long
    Local Buff As Asciiz * 4096
    Local BuffSize As Long
    
    BuffSize = SendMessage(BBSDown.txtHandle, %WM_GETTEXTLENGTH,0,0) '62 bytes on average
    
    If Not IsFalse BuffSize Then 'We have text there, grab it and add a $CrLf
        SendMessage BBSDown.txtHandle, %WM_GETTEXT, 0, ByVal VarPtr(Buff)
        Buff = Buff & $CrLf & sPacket
    Else
        Buff = sPacket
    End If
    SendMessage BBSDown.txtHandle, %WM_SETTEXT, 0, VarPtr(Buff)
    End Function
Working...
X