Print Page | Close Window

Taskpanel Remove item

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1274
Printed Date: 11 May 2024 at 8:03am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Taskpanel Remove item
Posted By: Woody
Subject: Taskpanel Remove item
Date Posted: 12 October 2004 at 3:21pm
Does anyone have a working example of how to remove a TaskPanelGroupItem using the Remove method? I'm having to use Group.Items.Clear, and then add them again, but this is causing problems and I can't find any documentation.



Replies:
Posted By: gshawn
Date Posted: 12 October 2004 at 3:31pm

Hi,

I may not be the best person to answer since I've only used the Suite for a couple of hours, but this is one way to remove an item:

wndTaskPanel.Groups(1).Items(1).Remove

That will remove the first item from the first panel. I hope this helps at least a little.



Posted By: Woody
Date Posted: 13 October 2004 at 5:27am
Thanks for trying, but that didn't work either.

I thought Remove should work like this:

Const ID_TASK_FIND_COMPANY_GROUP1 = 640

Set Group = wndTaskPanel.Groups.Add(ID_TASK_FIND_COMPANY_GROUP1, "Company Search")

Set Item = Group.Items.Add(ID_TASK_FIND_COMPANY_ITEM1, "", xtpTaskItemTypeControl)

Then:
      Set Group = wndTaskPanel.Groups.Find(640)
      Set Item = Group.Items.Remove(1)

What am I doing wrong?



Posted By: ianp
Date Posted: 13 October 2004 at 5:44am

Hi Woody

You can remove an item using Group.Items.Remove(1) however as it doesn't then return an TaskItem, your code will fail when you try to Set Item =  Group.Items.Remove(1)

The following code should work if you place it in a form with a taskpanel (wndTaskPanel) and a command button (command1). It will also allow you to specify your ID for the taskitem rather than having to know the Index position...

Const ID_TASK_FIND_COMPANY_GROUP1 As Long = 640
Const ID_TASK_FIND_COMPANY_ITEM1 As Long = 641
Private group As XtremeSuiteControls.TaskPanelGroup
Private item As XtremeSuiteControls.TaskPanelItem
Private Sub Command1_Click()
  Set group = wndTaskPanel.Groups.Find(ID_TASK_FIND_COMPANY_GROUP1)
  Debug.Print group.Items.Count
  Set item = group.Items.Find(ID_TASK_FIND_COMPANY_ITEM1)
  item.Remove
  Debug.Print group.Items.Count
End Sub
Private Sub Form_Load()
  Set group = wndTaskPanel.Groups.Add(ID_TASK_FIND_COMPANY_GROUP1, "Company Search")
  Set item = group.Items.Add(ID_TASK_FIND_COMPANY_ITEM1, "", xtpTaskItemTypeControl)
End Sub



Posted By: Woody
Date Posted: 13 October 2004 at 6:43am
I tried this out and I still get error 'Object doesn't support this property or method'
Using version 9.1, could this be a bug?



Posted By: SuperMario
Date Posted: 13 October 2004 at 7:15am
Ianp's code does work.

Try changing to this code, it will let you see the item that is being removed:
Set item = group.Items.Add(ID_TASK_FIND_COMPANY_ITEM1, "Some Text", xtpTaskItemTypeText)

This is assuming that you want to remove an item within a group and not an entire group.


Posted By: Woody
Date Posted: 13 October 2004 at 8:07am
Shouldn't Private item As XtremeSuiteControls.TaskPanelItem be Private item As XtremeSuiteControls.TaskPanelGroupItem ?

first one isn't recognised, and this may be the problem.


Posted By: SuperMario
Date Posted: 13 October 2004 at 9:31am
Yes you are right, I didn't see that you said you were using 9.1.  TaskPanelItem is an Interface added in 9.5.  I would recommend downloading the latest version if you can.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net