Home » U++ Library support » TreeCtrl » SetFocus with EditString as Node
Re: SetFocus with EditString as Node [message #41104 is a reply to message #41082] |
Thu, 31 October 2013 15:06 |
iST1
Messages: 107 Registered: August 2013
|
Experienced Member |
|
|
Mirek, can you fixed this code? I have no idea
class EditableTree : public TreeCtrl {
public:
typedef EditableTree CLASSNAME;
EditableTree() : selId_(0) {
NoRoot().MultiSelect(true).HighlightCtrl(false);
WhenSel = THISBACK(OnSelect);
}
int AddNode(int parent) {
EditString &edit = edit_.Add(edit_.GetCount());
edit.SetData("NODE" + AsString(GetChildCount(parent) + 1));
edit.AutoSize();
edit.SetFrame(NullFrame());
Node node;
node.SetCtrl(edit);
return Add(parent, node);
}
void OnAddNode() {
int id = AddNode(selId_);
Open(selId_);
edit_.Get(edit_.GetCount() - 1).SetFocus();
}
void OnSelect() {
if (GetSelectCount() <= 0 || selId_ == GetSel()[0])
return;
selId_ = GetSel()[0];
}
private:
int selId_;
ArrayMap<int, EditString> edit_;
};
GUI_APP_MAIN
{
TopWindow wnd;
Button btn;
wnd.Add(btn.SetLabel("Add").LeftPos(10).TopPos(10));
EditableTree tree;
wnd.Add(tree.VSizePos(40).HSizePos());
tree.AddNode(0);
tree.AddNode(0);
btn <<= callback(&tree, &EditableTree::OnAddNode);
wnd.Run();
}
[Updated on: Thu, 31 October 2013 15:07] Report message to a moderator
|
|
|
|
|
SetFocus with EditString as Node
By: iST1 on Sat, 05 October 2013 15:35
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Mon, 07 October 2013 20:20
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Mon, 21 October 2013 18:40
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Tue, 22 October 2013 19:34
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Wed, 23 October 2013 08:38
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Wed, 23 October 2013 08:49
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Mon, 28 October 2013 17:58
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Wed, 30 October 2013 09:46
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Thu, 31 October 2013 15:06
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Sun, 03 November 2013 08:20
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Sun, 03 November 2013 10:05
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Wed, 06 November 2013 16:36
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Thu, 07 November 2013 10:33
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Thu, 07 November 2013 15:58
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Thu, 07 November 2013 18:38
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Fri, 08 November 2013 07:58
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Fri, 08 November 2013 11:14
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Fri, 08 November 2013 11:26
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Fri, 08 November 2013 11:40
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Fri, 08 November 2013 17:46
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Sun, 10 November 2013 07:24
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Mon, 11 November 2013 09:34
|
|
|
Re: SetFocus with EditString as Node
By: mirek on Mon, 11 November 2013 15:46
|
|
|
Re: SetFocus with EditString as Node
By: iST1 on Mon, 11 November 2013 19:16
|
Goto Forum:
Current Time: Fri May 10 11:46:56 CEST 2024
Total time taken to generate the page: 0.02321 seconds
|