Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Append line into LineEdit or DocEdit
Append line into LineEdit or DocEdit [message #47078] Tue, 29 November 2016 11:58 Go to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Hi,

i have problem, i want just to add line into LineEdit or DocEdit.

I try (lignes is a LineEdit object and texte a Upp::String)

serveur.lignes <<= texte << "\n";


or

client.lignes.Insert(-1, ~(texte << "\n"));


but without succes.

How i can create simple text area, with vertical scrollbar, and write line into this ?

Thank you for your help !
Re: Append line into LineEdit or DocEdit [message #47080 is a reply to message #47078] Tue, 29 November 2016 15:19 Go to previous messageGo to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Hi,

i try:

void MyCLass::log( String texte )
{
	String contenu = gui.textarea.Get();
	contenu << texte << "\n";
	gui.textarea <<= contenu;
}


It's work but there are not simplest method ?

Thank !
Re: Append line into LineEdit or DocEdit [message #47082 is a reply to message #47080] Tue, 29 November 2016 21:50 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
I usually use LineEdit and this code from TheIDE to implement log window:
void XXX::Log(const String& txt)
{
	int l, h;

	log.GetSelection(l, h);
	log.SetEditable();
	log.MoveTextEnd();
	Vector<String> v = Split(txt, '\n');
	auto t = GetSysTime();
	for (int i = 0; i < v.GetCount(); i++){
		log.Paste(WString(Format("\n%02d:%02d:%02d: %s", t.hour, t.minute, t.second, v[i])));
	}
	log.SetReadOnly();
	log.SetSelection(l, h);
	log.ScrollEnd();
}

[Updated on: Tue, 29 November 2016 21:52]

Report message to a moderator

Re: Append line into LineEdit or DocEdit [message #47085 is a reply to message #47078] Wed, 30 November 2016 09:15 Go to previous messageGo to next message
lovmy is currently offline  lovmy
Messages: 44
Registered: November 2015
Member

Hi,

thank you for your response but what's "log" ?

I'm using LineEdit and i don't have .MoveTextEnd() and .ScrollEnd().

Best Regards.
Re: Append line into LineEdit or DocEdit [message #47088 is a reply to message #47085] Wed, 30 November 2016 12:44 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
log is an instance of LineEdit:

void MoveTextEnd(bool sel = false)
Moves the cursor in specified direction (Home/End are beginning/end of line). If sel is true, selects characters between starting and ending cursor position.

void ScrollEnd()
Scrolls the text to the end.

Take a look at the manual: http://ultimatepp.org/src$CtrlLib$LineEdit$en-us.html

[Updated on: Wed, 30 November 2016 12:44]

Report message to a moderator

Re: Append line into LineEdit or DocEdit [message #47091 is a reply to message #47088] Thu, 01 December 2016 14:31 Go to previous message
deep is currently offline  deep
Messages: 265
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

If you want to keep appending new lines to LineEdit following will work.

LineEdit lineedit;
for ( int i = 0; i < 10; i++ )
{
	s.Clear();
	s << "String 	>> " << i << "\n";
	lineedit.Paste ( s.ToWString() );
}


Warm Regards

Deepak
Previous Topic: Convert Upp::String to int
Next Topic: Problem with dialogs
Goto Forum:
  


Current Time: Fri Dec 13 22:52:14 CET 2024

Total time taken to generate the page: 0.03511 seconds