Home » U++ Library support » LineEdit, EditFields, DocEdit » LineEdit how to set selection from code
Re: LineEdit how to set selection from code [message #48961 is a reply to message #48956] |
Sun, 12 November 2017 08:34 |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
never mind used the following to figure it out
Leaving it here for the next guy...
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct test_led : public TopWindow
{
typedef test_led CLASSNAME;
int l,h;
Button btnLoad, btntest1, btntest2;
EditInt eba, ebc;
LineEdit led;
test_led()
{
Title("test_led").Sizeable().CenterScreen();
Add(btnLoad.LeftPos(5,60).TopPos(5,20)); btnLoad.SetLabel("Load..").WhenPush << [this]{ OpenFile(); };
Add(btntest1.LeftPos(70,60).TopPos(5,20)); btntest1.SetLabel("testget").WhenPush << [this]{ testget(); };
Add(btntest2.LeftPos(140,60).TopPos(5,20)); btntest2.SetLabel("testset").WhenPush << [this]{ testset(); };
Add(eba.LeftPos(210,100).TopPos(5,20));
Add(ebc.LeftPos(320,100).TopPos(5,20));
Add(led.HSizePosZ().VSizePosZ(30));// TopPosZ(30)); <--loses scrollbars!?
}
virtual ~test_led() {}
void OpenFile()
{
String sf=SelectFileOpen("Any\t*.*");
if (!sf.IsEmpty()) { FileIn fis(sf); led.Load(fis); }
}
void testget()
{
led.GetSelection(l, h);
eba=l;
ebc=h;
}
void testset()
{
l=~eba;
h=~ebc;
led.SetSelection(l, h);
}
};
GUI_APP_MAIN
{
test_led().Run();
}
[Updated on: Sun, 12 November 2017 08:37] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Mar 28 17:41:47 CET 2024
Total time taken to generate the page: 0.01291 seconds
|