Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

A little complicated problem

netgertnetgert Member Posts: 331
Hi!

I have to make a treeview with icons and when the user clics the icon, a popup menu will appear. Just like in InstallShield Wizard when selecting features to install. How to do this?

[hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi!
    :
    : I have to make a treeview with icons and when the user clics the icon, a popup menu will appear. Just like in InstallShield Wizard when selecting features to install. How to do this?
    :
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    I think that the InstallShield wizard doesn't use a TTreeView, but a TListView, although I'm not entirely sure. This however doesn't matter much of how to create such a thing. Here are a few steps you need to take to make this work:
    1. You need a TImageList to store the icons.
    2. Link the ImageList to the view using either the TTreeView.Images or the TListView.LargeImages.
    3. Now you can use the (TTreeNode OR TListItem).ImageIndex to select the appropriate icon.
    4. The OnClick() event needs to call the TPopupMenu.Popup() method. This will display the popup menu and focus it.
    (5.) You can access the selected icon using the Selected property of the TTreeView or the TListView.

    These things should create what you want to have. You can change the appearance using the other properties of the view. Fore more info on the various properties and methods see the help files.
  • netgertnetgert Member Posts: 331
    : : Hi!
    : :
    : : I have to make a treeview with icons and when the user clics the icon, a popup menu will appear. Just like in InstallShield Wizard when selecting features to install. How to do this?
    : :
    : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : :
    : I think that the InstallShield wizard doesn't use a TTreeView, but a TListView, although I'm not entirely sure. This however doesn't matter much of how to create such a thing. Here are a few steps you need to take to make this work:
    : 1. You need a TImageList to store the icons.
    : 2. Link the ImageList to the view using either the TTreeView.Images or the TListView.LargeImages.
    : 3. Now you can use the (TTreeNode OR TListItem).ImageIndex to select the appropriate icon.
    : 4. The OnClick() event needs to call the TPopupMenu.Popup() method. This will display the popup menu and focus it.
    : (5.) You can access the selected icon using the Selected property of the TTreeView or the TListView.
    :
    : These things should create what you want to have. You can change the appearance using the other properties of the view. Fore more info on the various properties and methods see the help files.
    :

    ISW uses treeview for hierarchical display. But I want to get popup menu to pop up ONLY if the user clicked IMAGE. Why there insn't X & Y parameter for the OnClick event??? It would make everything a lot easier.
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • zibadianzibadian Member Posts: 6,349
    : : : Hi!
    : : :
    : : : I have to make a treeview with icons and when the user clics the icon, a popup menu will appear. Just like in InstallShield Wizard when selecting features to install. How to do this?
    : : :
    : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : : :
    : : I think that the InstallShield wizard doesn't use a TTreeView, but a TListView, although I'm not entirely sure. This however doesn't matter much of how to create such a thing. Here are a few steps you need to take to make this work:
    : : 1. You need a TImageList to store the icons.
    : : 2. Link the ImageList to the view using either the TTreeView.Images or the TListView.LargeImages.
    : : 3. Now you can use the (TTreeNode OR TListItem).ImageIndex to select the appropriate icon.
    : : 4. The OnClick() event needs to call the TPopupMenu.Popup() method. This will display the popup menu and focus it.
    : : (5.) You can access the selected icon using the Selected property of the TTreeView or the TListView.
    : :
    : : These things should create what you want to have. You can change the appearance using the other properties of the view. Fore more info on the various properties and methods see the help files.
    : :
    :
    : ISW uses treeview for hierarchical display. But I want to get popup menu to pop up ONLY if the user clicked IMAGE. Why there insn't X & Y parameter for the OnClick event??? It would make everything a lot easier.
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    :
    I know, but there are ways around it, such as the OnMouseDown event. Write a OnMouseDown event in which you copy the mouse position to a variable. Then use that variable in your OnClick event.
  • netgertnetgert Member Posts: 331
    : : : : Hi!
    : : : :
    : : : : I have to make a treeview with icons and when the user clics the icon, a popup menu will appear. Just like in InstallShield Wizard when selecting features to install. How to do this?
    : : : :
    : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : : : :
    : : : I think that the InstallShield wizard doesn't use a TTreeView, but a TListView, although I'm not entirely sure. This however doesn't matter much of how to create such a thing. Here are a few steps you need to take to make this work:
    : : : 1. You need a TImageList to store the icons.
    : : : 2. Link the ImageList to the view using either the TTreeView.Images or the TListView.LargeImages.
    : : : 3. Now you can use the (TTreeNode OR TListItem).ImageIndex to select the appropriate icon.
    : : : 4. The OnClick() event needs to call the TPopupMenu.Popup() method. This will display the popup menu and focus it.
    : : : (5.) You can access the selected icon using the Selected property of the TTreeView or the TListView.
    : : :
    : : : These things should create what you want to have. You can change the appearance using the other properties of the view. Fore more info on the various properties and methods see the help files.
    : : :
    : :
    : : ISW uses treeview for hierarchical display. But I want to get popup menu to pop up ONLY if the user clicked IMAGE. Why there insn't X & Y parameter for the OnClick event??? It would make everything a lot easier.
    : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : :
    : :
    : I know, but there are ways around it, such as the OnMouseDown event. Write a OnMouseDown event in which you copy the mouse position to a variable. Then use that variable in your OnClick event.
    :


    Err... OnMouseUp i think since mouse might be pushed down on icon but released on text and this is not *exact* result. By combining "MouseDownXY" (assigned i OnMouseDown) and X,Y in OnMouseUp event (to c wheter they occured in icon rect) I should get what I need, right? The reason i'm asking is that I don't have D here @ school, I have it @ home.
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • zibadianzibadian Member Posts: 6,349
    : : : : : Hi!
    : : : : :
    : : : : : I have to make a treeview with icons and when the user clics the icon, a popup menu will appear. Just like in InstallShield Wizard when selecting features to install. How to do this?
    : : : : :
    : : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : : : : :
    : : : : I think that the InstallShield wizard doesn't use a TTreeView, but a TListView, although I'm not entirely sure. This however doesn't matter much of how to create such a thing. Here are a few steps you need to take to make this work:
    : : : : 1. You need a TImageList to store the icons.
    : : : : 2. Link the ImageList to the view using either the TTreeView.Images or the TListView.LargeImages.
    : : : : 3. Now you can use the (TTreeNode OR TListItem).ImageIndex to select the appropriate icon.
    : : : : 4. The OnClick() event needs to call the TPopupMenu.Popup() method. This will display the popup menu and focus it.
    : : : : (5.) You can access the selected icon using the Selected property of the TTreeView or the TListView.
    : : : :
    : : : : These things should create what you want to have. You can change the appearance using the other properties of the view. Fore more info on the various properties and methods see the help files.
    : : : :
    : : :
    : : : ISW uses treeview for hierarchical display. But I want to get popup menu to pop up ONLY if the user clicked IMAGE. Why there insn't X & Y parameter for the OnClick event??? It would make everything a lot easier.
    : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    : : :
    : : :
    : : I know, but there are ways around it, such as the OnMouseDown event. Write a OnMouseDown event in which you copy the mouse position to a variable. Then use that variable in your OnClick event.
    : :
    :
    :
    : Err... OnMouseUp i think since mouse might be pushed down on icon but released on text and this is not *exact* result. By combining "MouseDownXY" (assigned i OnMouseDown) and X,Y in OnMouseUp event (to c wheter they occured in icon rect) I should get what I need, right? The reason i'm asking is that I don't have D here @ school, I have it @ home.
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    :
    No you need the OnMouseDown event, because the order in which the events happen is as follows: OnMouseDown, OnClick, OnMouseUp. This means that you cannot get the position from the OnMouseUp to the OnClick. I checked this using a small test project.
Sign In or Register to comment.