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 » Community » Newbie corner » display file data and picking a line (Function opening a text file then picking and working with line data.)
display file data and picking a line [message #46483] Sun, 15 May 2016 10:42 Go to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Function opening a text file then picking and working with line data.

I have an app that can open files and draw lines from lat,lon points. Replay gps tracking with lat,lon points, etc.

But I would like to be able to open a text file in a window other than the dlglay then pick a line that has a description and lat,lon coordinates. The lat,lon position can be fed into existing code to change the view position in a 3D globe app (NASA wwj)

Actually displaying a text file and picking a line to feed the data with a upp app I have not done that before.




Is there an example, bazarr, reference, tutorial or whatever that may help with this?

Any help would be appreciated.

Neil



edit: what I do now is open a file, copy the lat,lon and paste that into a upp edit field in an upp app.
I would like to eliminate the copy and paste.

[Updated on: Sun, 15 May 2016 11:06]

Report message to a moderator

Re: display file data and picking a line [message #46488 is a reply to message #46483] Sun, 15 May 2016 15:11 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 536
Registered: March 2007
Contributor
#include <CtrlLib/CtrlLib.h>

using namespace Upp;


class test : public TopWindow {
public:
	typedef test CLASSNAME;
	test(){
		FileStream fs("Main.cpp", BlockStream::READ);
		
		Add(lbl.SetLabel("Some Text To Begin With").TopPos(2).HSizePos());
		
		edit.Load(fs);
		edit.WhenSel = THISBACK(UpdateCoords);
		Add(edit.HSizePos().VSizePos(20));
		
		curln=-1;
	}
	
	void UpdateCoords(){
		int ln=edit.GetCursorLine();
		if(ln != curln)
		{
		
			lbl.SetLabel(edit.GetEncodedLine(ln));
			curln = ln;
		}
	}
	
	Label    lbl;
	LineEdit edit;
	int curln;
};

GUI_APP_MAIN
{
	test().Run();
}


Note WhenSel is not called when the control is initially displayed. You can add a little code to cope with the situation.
Re: display file data and picking a line [message #46491 is a reply to message #46488] Sun, 15 May 2016 20:05 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Thanks Lance

I will see what I can do with that.
Previous Topic: Run a slow process in another thread to not block GUI
Next Topic: gui , how to switch between the visual dlg.lay to the text view
Goto Forum:
  


Current Time: Thu Jun 20 23:36:33 CEST 2024

Total time taken to generate the page: 0.02018 seconds