is there a simple way to make a stringgadget stay scrolled down at the bottom?
i'm working on a chat client, and i'm using a read-only string-gadget for the conversation text, but the only way i know to add to it is by re-writing all of the text to the gadget. The problem being that when i do that, the window is scrolled to the top, leaving the latest text at the bottom, which needs to be scrolled to.
any suggestions would be appreciated.
thanks in advance,
Aszid
Stringgadget question
Stringgadget question
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.
use a listview gadget and use this:
Code: Select all
SetGadgetState(#LISTVIEW_GADGET, CountGadgetItems(#LISTVIEW_GADGET)-1)
hmm... i considered doing that, but i want to keep copy-paste functionality for the window, and i'm relatively sure you can't select just a portion of a line with a listviewgadget.
i was hoping for a quick flag or something that i could add at gadget creation that would make it stay at the bottom... but alas... maybe i'll go suggest that in the feature request thread.
i was hoping for a quick flag or something that i could add at gadget creation that would make it stay at the bottom... but alas... maybe i'll go suggest that in the feature request thread.
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.
try this:
Code: Select all
#Window_0 = 0
#Gadget_0 = 0
#Gadget_1 = 1
#Gadget_2 = 2
Procedure AddText()
exsistingText.s = GetGadgetText(#Gadget_0)
If exsistingText = ""
SetGadgetText(#Gadget_0, GetGadgetText(#Gadget_1))
Else
SetGadgetText(#Gadget_0, exsistingText + Chr(13) + Chr(10) + GetGadgetText(#Gadget_1))
EndIf
lines = SendMessage_(GadgetID(#Gadget_0),#EM_GETLINECOUNT,0,0)
SendMessage_(GadgetID(#Gadget_0), #EM_LINESCROLL, 0, lines)
EndProcedure
If OpenWindow(#Window_0, 338, 281, 439, 254, #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered , "New window ( 0 )")
If CreateGadgetList(WindowID())
StringGadget(#Gadget_0, 5, 5, 430, 210, "", #ES_MULTILINE | #ES_AUTOVSCROLL | #ES_AUTOHSCROLL | #WS_VSCROLL | #WS_HSCROLL)
StringGadget(#Gadget_1, 5, 225, 345, 21, "")
ButtonGadget(#Gadget_2, 358, 222, 77, 25, "Enter >>>")
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_EventGadget
Select EventGadgetID()
Case #Gadget_2
AddText()
EndSelect
EndSelect
Until Event = #PB_EventCloseWindow
End
Last edited by Kale on Tue May 13, 2003 11:13 pm, edited 1 time in total.
awesome!
thanks alot for the help, i only needed 2 lines of the code, but those 2 work perfectly.
i REALLY love the community that purebasic has, i asked a question, and within a few hours 3 people made suggestions for me.
Professional technical support is nowhere near the quality that the community provides here.
thanks alot for the help, i only needed 2 lines of the code, but those 2 work perfectly.
i REALLY love the community that purebasic has, i asked a question, and within a few hours 3 people made suggestions for me.
Professional technical support is nowhere near the quality that the community provides here.
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.
i found a better way to do this, so i thought i'd share with the forums.
this works on editorgadgets... haven't tried it on anything else.
all you need to do... is replace these 2 lines:
with this one line:
this works on editorgadgets... haven't tried it on anything else.
all you need to do... is replace these 2 lines:
Code: Select all
lines = SendMessage_(GadgetID(#Gadget_0),#EM_GETLINECOUNT,0,0)
SendMessage_(GadgetID(#Gadget_0), #EM_LINESCROLL, 0, lines)
Code: Select all
SendMessage_(GadgetID(#Gadget_0), #EM_SCROLLCARET, 0,0)
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.


