Print Page | Close Window

Add Item

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=14603
Printed Date: 02 May 2024 at 6:50pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Add Item
Posted By: cmm2006
Subject: Add Item
Date Posted: 23 June 2009 at 2:25pm
Hi,
I have a recordset containing a number of records of events, and I am trying to add today's events to agroup (each event is an item). how can I be able to do so?
thank you
 
 
Visual Basic 6 SP6
CJ 12.1.1
Windows XP Pro



Replies:
Posted By: Peter59
Date Posted: 23 June 2009 at 3:32pm
Hi,

it's not difficult to do so:

- add a TaskPanelGroup to your task panel
- loop thru your recordset with events and add an TaskPanelItem for each event
- use event TaskPanel_ItemClick to get informed when an item is clicked

See attached sample (can't upload sample now, will upload later)

Peter

cmm2006: Please add a signature to your posts so all members can see what version do you use...


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows 7 64 Bit
Language: Visual Basic 6.0 SP6


Posted By: cmm2006
Date Posted: 25 June 2009 at 7:50am

Hello,

the problem here is the Item ID that I have to assign to the item so I can add it to the pannel. ID should be declared before...
thank you


-------------
Language: Visual Basic 6 SP6
OS: Windows XP Pro SP3
Product: Codejock Xtreme SuitePro 13.1


Posted By: Peter59
Date Posted: 25 June 2009 at 4:06pm
Hello,

there is still no uplaod button here so I have to explain it this way.

My VB sample project

Assuming you have a recordset rsEvents with events (from database forexample)

1. Create a new project
2. Add a reference to MS ActiveX Data Objects
3. Add a CodeJock TaskPanel control named TaskPanel, 4 labels, 4 textboxes and a MS ImageList named TaskPanelIcons



4. Add at least 3 icons 16x16 to the image list
5. add following code to Form1


Option Explicit

Dim rsEvents As ADODB.Recordset


Private Sub Form_Load()
    InitControls
    InitEvents
    InitTaskpanel
End Sub 'Form_Load()

Private Sub InitControls()

    Label1.Caption = "EventID"
    Label2.Caption = "EventText"
    Label3.Caption = "Description"
    Label4.Caption = "EventTime"

    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""

End Sub 'InitControls()

Private Sub InitEvents()

    Dim i As Long

    '-- create in memory recordset, your data can differ
    Set rsEvents = New ADODB.Recordset
    With rsEvents
        .Fields.Append "EventID", adInteger
        .Fields.Append "EventText", adVarChar, 255, adFldIsNullable
        .Fields.Append "Description", adVarChar, 1000, adFldIsNullable
        .Fields.Append "EventTime", adDate
    End With
    rsEvents.Open

    '-- add some events
    For i = 1 To 30
        rsEvents.AddNew
        rsEvents!EventID = i
        rsEvents!EventText = "Event " & Format(i, "00")
        rsEvents!Description = "Brief description of event " & Format(i, "00")
        rsEvents!EventTime = Now()
        rsEvents.Update
    Next i

End Sub 'InitEvents()

Private Sub InitTaskpanel()

    Dim Group As XtremeTaskPanel.TaskPanelGroup
    Dim Item As XtremeTaskPanel.TaskPanelGroupItem


    TaskPanel.Align = vbAlignLeft

    Set Group = TaskPanel.Groups.Add(0, "Todays events")
    With Group
        .Tooltip = "These events occured today"
        .Special = True
   
        rsEvents.MoveFirst
        Do Until rsEvents.EOF
            .Items.Add rsEvents!EventID, rsEvents!EventText, xtpTaskItemTypeLink, Int(3 * Rnd + 1)
            rsEvents.MoveNext
        Loop
   
        .Expanded = True
    End With

    TaskPanel.SetImageList TaskPanelIcons

End Sub 'InitTaskpanel()

Private Sub TaskPanel_ItemClick(ByVal Item As XtremeTaskPanel.ITaskPanelGroupItem)

    Dim EventID As Long
   
    EventID = Item.Id

    rsEvents.Filter = "EventID=" & EventID

    If Not rsEvents.EOF Then
        Text1.Text = rsEvents!EventID
        Text2.Text = rsEvents!EventText
        Text3.Text = rsEvents!EventTime
        Text4.Text = rsEvents!Description
    End If

    rsEvents.Filter = adFilterNone

End Sub 'TaskPanel_ItemClick()



6. Run project and click on TaskPanelItems

Is this what you're looking for?

Peter


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows 7 64 Bit
Language: Visual Basic 6.0 SP6



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