Print Page | Close Window

Having problem with ExpandButton

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=16726
Printed Date: 15 November 2024 at 11:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Having problem with ExpandButton
Posted By: Mike Lewis
Subject: Having problem with ExpandButton
Date 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



Replies:
Posted By: Aaron
Date 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....


Posted By: Mike Lewis
Date 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


Posted By: SuperMario
Date Posted: 20 May 2010 at 9:25am
why not just add a ReportItemButton?


Posted By: Mike Lewis
Date 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


Posted By: SuperMario
Date 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





Posted By: Mike Lewis
Date 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



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