
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Button to minimize/maximize chart
Hi,
I'm trying to use a button to enable a chart to appear maximized (as opposed to having to double-click on the minimized chart object). The button would thus make the chart appear/disappear. Any insights?
Thanks,
Mat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use the Minimize, Maximize and Restore functions.
ActiveDocument.GetSheetObject("CH01").Maximize
You may want to use Restore instead though. Restore should set it to it's predefined size, whereas Maximize makes it take up the entire screen.
ActiveDocument.GetSheetObject("CH01").Restore
If you want to toggle Restored and Minimized, then use something like:
Sub ToggleMin
set obj = ActiveDocument.GetSheetObject("CH01")
If obj.IsMinimized Then
obj.Restore
Else
obj.Minimize
End If
End Sub


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The macro would certainly work.
If you are in QV9 environment, for Buttons you can find "Minimize Object" action under Actions -> Layout (Action type). Here you can specify the object ID (SH01, TB01, etc) of your object you want to minimize via this button. The beauty is you can have more than one action here, so sequentially you could minimize 10 objects by pressing this button. Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matt,
You can use buttons to maximaize and minimize chart objects. But this can be done using perdefined macros in QV9.0. In QV 9.0 you have a predefined action called 'Minimize Object' and 'Maximize Object' in the Action type Layout. You must selec this action and then just specify the ID of the Object you want to minimize or maximize. This works fine matt. You have to add this action to a Button so that these actions can be performed by clicking on a button. For this just create a button, and go to its properties and add the specific actions mentioned above using the add action tab. Hope this helps you.......
Thanks....... Joseph

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sweet. Love the macro option. But I now need to add a one feature:
Now that I can name the button after the chart, the minimized chart doesn't need to be there anymore. Just the button, when pressed maximizes the chart, when pressed again makes the chart disappear altogether (not minimized).
Thanks for help,
Mat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, then don't bother with min/max at all, just use visibility.
Create a variable, something like vVisible. Then on your chart, set the Conditional Show (Layout tab) to vShow = 1. Then for your macro:
Sub Test
set var = ActiveDocument.Variables("vVisible")
val = var.GetContent.String
if val = 0 then
var.SetContent 1, true
else
var.SetContent 0, true
end if
End Sub
That should work, but I didn't test it. Okay, I tested it, should work.
Make sure you disable Allow Minimize and Allow Maximize on the chart options.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Works like a charm. Do you know of any good vbscript code examples deployed in QV. I'm finding that I need to learn more about the possibilities of implementing documents with nifty macros. Thnx

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check out the APIGuide.qvw. It is a QlikView application that should have been installed with QlikView. It can also be found at http://www.qlik.com/download.
There is a reference section and an examples section. I am constantly using the examples section. They are not always the best examples, but you can usually use them to figure out what you need to do.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mat wrote:I'm finding that I need to learn more about the possibilities of implementing documents with nifty macros.
We should probably give you the standard warnings about using Macros. QlikTech seems to consider them sort of a second tier of functionality. Testing is done first and foremost on the product itself, not on the macro API. So while I've had few problems with Macros, they're in a sense inherently less stable. Macros can be rather slow to execute. Using a macro will cause all of your cached data to be marked stale. Use a macro, switch tabs, and that giant chart will be rendered from scratch again rather than pulled from a cache. So generally speaking, if there's an acceptable alternative to using a macro, it is best to use the alternative. But macros often let you do things that you simply couldn't do otherwise, or do things that make the users much happier even if there was an alternative, so they're also too valuable to completely ignore.
