Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Task Panel
  New Posts New Posts RSS Feed - Add Item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Add Item

 Post Reply Post Reply
Author
Message
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post Topic: Add Item
    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
Back to Top
Peter59 View Drop Down
Groupie
Groupie


Joined: 19 July 2007
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote Peter59 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
cmm2006 View Drop Down
Senior Member
Senior Member


Joined: 26 September 2006
Status: Offline
Points: 118
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmm2006 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Peter59 View Drop Down
Groupie
Groupie


Joined: 19 July 2007
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote Peter59 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.