Recent

Author Topic: TreeView, what is selected?  (Read 10205 times)

xmldom

  • New Member
  • *
  • Posts: 10
TreeView, what is selected?
« on: January 25, 2012, 07:17:11 pm »
Hi, I have TreeView an Edit on my Form.
How can I write actually selected item in TreeView to Edit?

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: TreeView, what is selected?
« Reply #1 on: January 25, 2012, 08:28:01 pm »
Create an OnChange event handler for the Treeview and enter:

Code: [Select]
Edit1.Text:=Node.Text;
Node is a parameter of the Onchange event handler.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: TreeView, what is selected?
« Reply #2 on: January 26, 2012, 03:51:37 am »
OR:

if TreeView1.Selected <> nil then Edit1.Text:= TreeView1.Selected.Text;
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis
Re: TreeView, what is selected?
« Reply #3 on: January 26, 2012, 07:03:53 am »
Also:
if TreeView1.Selected.Level = 0 then # node

ajosifoski

  • Jr. Member
  • **
  • Posts: 55
Re: TreeView, what is selected?
« Reply #4 on: March 28, 2013, 08:47:59 pm »
Hi, I have some kind of different problem.

When changing focus on another object selected item of TreeView loses selection.

Any idea how to solve that?
Tnx

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TreeView, what is selected?
« Reply #5 on: March 28, 2013, 09:25:48 pm »
No, the item is still selected, but the selection is hidden. Set HideSelection to false.

ajosifoski

  • Jr. Member
  • **
  • Posts: 55
Re: TreeView, what is selected?
« Reply #6 on: March 28, 2013, 09:36:36 pm »
No, the item is still selected, but the selection is hidden. Set HideSelection to false.
I've did it, but still problem occurs.
Deciced to upgrade current 0.9.30.2-2 to newest release to see what will happened.
Linux Mint
nice instructions here: http://www.lazarus.freepascal.org/index.php?topic=15432.0

ajosifoski

  • Jr. Member
  • **
  • Posts: 55
Re: TreeView, what is selected?
« Reply #7 on: March 29, 2013, 11:56:42 am »
Upgrading on 1.0.8 problem disapears.

 

TinyPortal © 2005-2018