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 » Developing U++ » UppHub » Using TerminalCtrl - does not compile
Using TerminalCtrl - does not compile [message #57915] Tue, 28 December 2021 07:57 Go to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
(nightly 16138)

Trying to use Terminal in a `test` package (U++ CtrlLib application with main window), no edits,
and as a first-time dry-run I included the Terminal package in `test`, again no edits, & try to compile, got:
/home/mais/upphub/TerminalCtrl/Terminal/Page.cpp (82): error: invalid operands to binary expression ('Upp::WString' and 'Vector<Upp::char16>' (aka 'Vector<unsigned short>'))

There does not seem to be a ToUtf16()-variant that takes dword as argument and outputs WString

---
Also, in Terminal.h for `class TerminalCtrl : public Ctrl {` the reference/implementation topic (bluebox in editor's left column) flashes while there is mousemovement but never shows. This may be a Upp-bug since a random check shows same
happen in line 16 of Draw.h for `class Draw;`
Re: Using TerminalCtrl - does not compile [message #57917 is a reply to message #57915] Tue, 28 December 2021 08:29 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello slashupp,

Should be fixed now. Please check.

Best regards,
Oblivion


Re: Using TerminalCtrl - does not compile [message #57920 is a reply to message #57917] Tue, 28 December 2021 10:40 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
what did you change so I can make the same change local without having to download the whole thing needlessly
Re: Using TerminalCtrl - does not compile [message #57921 is a reply to message #57920] Tue, 28 December 2021 10:47 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
The problem was wchar32 support. ToUtf16() variant is apparently removed (part of wchar32 changes...).

In Page.cpp, ln: 82, change the existing code to:

 txt.Cat((int) cell.chr, 1); // wchar32 text-copy


It should work.

For a quick and heavy test, I suggest you trying out the vtm demo on TerminalExample:

ssh vtm@netxs.online



Best regards,
Oblivion


Re: Using TerminalCtrl - does not compile [message #57925 is a reply to message #57921] Tue, 28 December 2021 12:33 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member

I want to do my own tests of this ctrl - always best way

observations:

0. initially blank box with blinking box-caret and right-click menu & nothing much to do

1. should by default open either at user's home-dir or in root(/) if user is root

2. no clear and obvious way to specify in code where/what the ctrl should display
...browsing the source & can find no way to specify initial display...


Re: Using TerminalCtrl - does not compile [message #57926 is a reply to message #57925] Tue, 28 December 2021 13:12 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello slashupp,

Thank you for your observations. They will certainly help me improve and polish the ctrl.

As for the specific issues you've pointed out:

Quote:
I want to do my own tests of this ctrl - always best way


I respectfully disagree. Playing with the reference examples first would be the recommended way, if not the best. Always. Because the provided reference examples demonstrate the different aspects and use-cases of the package. And they are meant to run out-of-the box. Not to mention they are well-tested over different platforms.


Quote:

0. initially blank box with blinking box-caret and right-click menu & nothing much to do
1. should by default open either at user's home-dir or in root(/) if user is root


Again, the reference examples already demonstrate this. IT is the job of pty process to provide the environment, not of TerminalCtrl.
Have you connected the TerminalCtrl to a "source"? (e.g. a pty, via the provided ptyprocess class. See the TerminalExample)


Quote:
2. no clear and obvious way to specify in code where/what the ctrl should display
...browsing the source & can find no way to specify initial display...


Documentation certainly needs improvements. While the package already comes with an API doc, which you can display with TheIDE, ReFerence examples alredy show how to do this and more (e.g. even tabbed or splitted displays).

If you need more help let me know.


Best regards,
Oblivion


[Updated on: Tue, 28 December 2021 13:16]

Report message to a moderator

Re: Using TerminalCtrl - does not compile [message #57927 is a reply to message #57926] Tue, 28 December 2021 14:07 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
OK I'll RTFM (sigh)
(I like things to be intuitive, easy, like the rest of UPP/theide)

...
Just for lols...
Quote:
I respectfully disagree. Playing with the reference examples first would be the recommended way, if not the best. Always.

Two ways to acquire knowledge/experience:
1. be taught - you hear/see someone else's experiences and need figure out how to emulate that
2. learn - the hard way through own experience
The first way is dicey, can take long time and is repetitive, the second way is surer, shorter, more retentive by nature first time round.
...

Anyway, thx for your patience, I'll sure give the ctrl a hammering, & keep you updated with anything worthwhile.
Re: Using TerminalCtrl - does not compile [message #57929 is a reply to message #57927] Tue, 28 December 2021 14:42 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello slashupp

Handling 60+ years of inconsistent mess in a single package is not easy. Very Happy I really don't know how it can get more intuitive than this. (You can check vte et al. to see the difference)

Here is an -almost- barebone terminal example with comments.

#include <Terminal/Terminal.h>
#include <PtyProcess/PtyProcess.h>


using namespace Upp;

struct Terminal : TopWindow {
	TerminalCtrl term;
	PtyProcess pty;

	Terminal()
	{
		Sizeable().Zoomable().CenterScreen().Add(term.SizePos());
		SetRect(term.GetStdSize());						// Optional: Sets a 80x24 display
		term.WhenOutput = [=](String s) { pty.Write(s); };			// Writes user input to the pty..
		term.WhenResize = [=]()         { pty.SetSize(term.GetPageSize()); };	// Informs the pty/system about the terminal size change
		pty.Start(GetEnv("SHELL"), Environment(), GetHomeDirectory());          // Runs the user shell (e.g. bash) with the user environment and user home dir.
		SetTimeCallback(-1, [=] {						// Polls for the pending data in pty (average performance, but simple).
				if(!pty.IsRunning())
					Break();
				term.WriteUtf8(pty.Get());				// Writes the data from the source (in this case, pty+shell to terminalctrl...
		});
	}
};

GUI_APP_MAIN
{
	Terminal().Run();
}



If you need more help, just ask, I'll try my best.

Best regards,
Oblivion


[Updated on: Tue, 28 December 2021 14:47]

Report message to a moderator

Re: Using TerminalCtrl - does not compile [message #58092 is a reply to message #57915] Sat, 12 February 2022 19:09 Go to previous message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Oops, wrong topic. [PLEASE DELETE ME]

[Updated on: Sat, 12 February 2022 19:15]

Report message to a moderator

Previous Topic: Problems
Next Topic: AutoScroller package update
Goto Forum:
  


Current Time: Thu Mar 28 17:10:26 CET 2024

Total time taken to generate the page: 0.00936 seconds