Clickable pictures in reports?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Clickable pictures in reports?

John Chludzinski
To make pics clickable I first subclassed MAReport adding an instance
variable to maintain a reference to the component in which the report
is created:

MAReport subclass: #MMAReport
    instanceVariableNames: 'component'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'MMAApp'!

!MMAReport methodsFor: 'accessing' stamp: 'jtc 6/9/2009 18:15'!
component

    ^ component! !

!MMAReport methodsFor: 'accessing' stamp: 'jtc 6/9/2009 18:16'!
component: c

    component _ c! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

MMAReport class
    instanceVariableNames: ''!

!MMAReport class methodsFor: 'instance creation' stamp: 'jtc 6/9/2009 18:16'!
rows: aCollection description: aDescription component: aComponent

    | report |

    report := self rows: aCollection.
    aDescription asContainer do: [ :each |
        report addColumnDescription: each ].
    report component: aComponent.
    ^ report! !

------------------------------------------------------------------------------------------------------------------

I next modified #renderCellContent:on: in class
MMADescribedImageColumn (my #reportColumnClass: class).

!MMADescribedImageColumn methodsFor: 'rendering' stamp: 'jtc 6/9/2009 18:16'!
renderCellContent: anObject on: html

        | myValue ibt |

        myValue _ self valueFor: anObject.

        (myValue isNil or: [myValue contents isEmpty]) ifTrue: [
                ^html render: (self formatter value: myValue)].

        html form: [
                ibt _ html imageButton.
                ibt url: (ibt canvas context urlForDocument: myValue contents
mimeType: myValue mimetype fileName: nil).
                ibt callback: callback: [ self report component editBuddy: anObject
]. "This is where the report's reference to the component (that
created it) is used."
        ].
! !

This works but I was considering subclassing MMADescribedImageColumn
from MACommandColumn instead of MADescribedColumn.  Would this have
been a better approach?

---John
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Clickable pictures in reports?

EstebanLM
I have a child of MADescribedColumn for perform that task, and works
well... and seems to be a less intrusive approach, IMHO.

Cheers,
Esteban

On 2009-06-10 01:40:13 -0300, John Chludzinski
<[hidden email]> said:

> To make pics clickable I first subclassed MAReport adding an instance
> variable to maintain a reference to the component in which the report
> is created:
>
> MAReport subclass: #MMAReport
>     instanceVariableNames: 'component'
>     classVariableNames: ''
>     poolDictionaries: ''
>     category: 'MMAApp'!
>
> !MMAReport methodsFor: 'accessing' stamp: 'jtc 6/9/2009 18



_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki