Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Having problem with ExpandButton
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Having problem with ExpandButton

 Post Reply Post Reply
Author
Message
Mike Lewis View Drop Down
Groupie
Groupie


Joined: 29 April 2009
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mike Lewis Quote  Post ReplyReply Direct Link To This Post Topic: Having problem with ExpandButton
    Posted: 19 May 2010 at 3:14pm
I hope this is a simple question.

I am using version 13.1.

I am trying to add an ExpandButton to a column. I want it to appear in every row for the column.

I have tried doing the following (where oCol is an object reference to the column):

oCol.EditOptions.AddExpandButton(0)

But the button does not appear. I just see an empty column. I've tried clicking and double-clicking in a cell, but that makes no difference.

I also tried doing this in each cell within the column:

oItem.CreateEditOptions()

The effect was to make the cell editable, but still no sign of the button.

I've successfully created a combo button for the same grid. It's just the expand button that has defeated me.

I'd be grateful for your help. I expect I'm missing something quite simple.

Mike
Mike Lewis
Software Developer
Edinburgh, Scotland
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2010 at 12:34am
Hi Mike,
 
This is most basic code to have an ExpandButton for every single ReportItem in the column:
   
        
    wndReportControl.AllowEdit = True
   
    Dim oCol As XtremeReportControl.ReportColumn
    Set oCol  = wndReportControl.Columns.Add(0, "Column 1", 50, True)
          oCol.EditOptions.AddExpandButton True
 
 
 
 
If you don't want ExpandButton for entire column just add ExpandButton for a single ReportItem:
 
    Dim xtremeRecordItem As XtremeReportControl.ReportRecordItem
    Dim xtremeRecord As XtremeReportControl.ReportRecord
    Set xtremeRecordItem = xtremeRecord.AddItem("Some text")
          xtremeRecordItem.CreateEditOptions
          xtremeRecordItem.EditOptions.AddExpandButton True
 
 
Hope this helps
   
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
Mike Lewis View Drop Down
Groupie
Groupie


Joined: 29 April 2009
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mike Lewis Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2010 at 3:45am
Aaron,

Many thanks for your very helpful reply. Your code did the trick.

However, now that I can see the ExpandButton, I realise it's not what I was expecting. It seems the button is meant to form part of an editable cell, where the user can either edit the text directly or click on the button to access more options.

What I really wanted was a cell that only contains a button - no text - and when the user clicks the button, I can open a context menu. I know I can do that in the right-click event, but I wanted to provide a button as an alternative.

I guess an Expand Button is the wrong choice for that. Never mind. I'll try to simulate it on some way, perhaps with a hyperlink. Thanks anyway for your reply.

Mike
Mike Lewis
Software Developer
Edinburgh, Scotland
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2010 at 9:25am
why not just add a ReportItemButton?
Back to Top
Mike Lewis View Drop Down
Groupie
Groupie


Joined: 29 April 2009
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mike Lewis Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2010 at 10:09am
SuperMario,

That's a good question. The answer is: Because I didn't know it existed.

I've found the Help topic for the ReportItemButton, and also the list of its PEMs. But I can't see how to add it to a report. Can you give me some guidance on how to get started with it?

Thanks.

Mike
Mike Lewis
Software Developer
Edinburgh, Scotland
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2010 at 11:16am
Look at ItemControls samples - part of the VB6 Report Sample......here is the basics to adding 2 buttons

    Dim i As Integer

    'Assign icon IDs
    For i = 0 To 6
        iconArray(i) = i + 1
    Next

    'Load icons
    wndReportControl.Icons.LoadBitmap App.Path & "\Icons\itemcontrols.bmp", iconArray, xtpImageNormal

    Dim Record As ReportRecord
    Dim Item As ReportRecordItem
    Dim Button As ReportItemButton

    'Adds new record
    Set Record = wndReportControl.Records.Add()

    'Add items
    i = 0
        'Add item
        Set Item = Record.AddItem("Row - " & Record.Index + 1 & ", Column - " & i + 1)
        Item.Editable = True
        'Add button "Alignment"
        Set Button = Item.ItemControls.AddButton(-1)
        'Button.Alignment = xtpReportItemControlLeft
        Button.Alignment = xtpReportItemControlRight
        Button.SetIconIndex xtpReportItemButtonStateNormal, 1
        Button.SetIconIndex xtpReportItemButtonStatePressed, 2
        Button.SetSize 22, 0
        'Add button "Color"
        Set Button = Item.ItemControls.AddButton(-1)
        Button.Alignment = xtpReportItemControlRight
        Button.SetIconIndex xtpReportItemButtonStateNormal, 5
        Button.SetIconIndex xtpReportItemButtonStatePressed, 6
        Button.SetSize 22, 0
        'Add button "Bold"
        Set Button = Item.ItemControls.AddButton(-1)
        Button.Alignment = xtpReportItemControlRight
        Button.SetIconIndex xtpReportItemButtonStateAll, 4
        Button.CaptionColor = 255
        Button.SetSize 22, 0

    wndReportControl.Populate



Back to Top
Mike Lewis View Drop Down
Groupie
Groupie


Joined: 29 April 2009
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mike Lewis Quote  Post ReplyReply Direct Link To This Post Posted: 21 May 2010 at 3:07am
SuperMario,

Unfortunately, I can't look at the VB sample reports as I don't use VB. But that's OK, because your code sample tells me what I need to know.

I'll give it a try and report back. Many thanks.

Mike
Mike Lewis
Software Developer
Edinburgh, Scotland
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.125 seconds.