Carousel.ItemRealizing

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
zigzigzig
Posts: 10
Joined: Tue May 30, 2017 11:31 pm

Carousel.ItemRealizing

Post by zigzigzig »

Hello All,

Toying around with carousel controls, trying to implement external buttons that appear and reappear based on carousel item entry:

Code: Select all

Evtroutine Handling(#Button1.Click)
#Carousel1.previtem Animate(False)
Endroutine

Evtroutine Handling(#Button2.Click)
#Carousel1.nextitem Animate(False)
Endroutine

Evtroutine Handling(#Carousel1.ItemRealizing) Item(#theItem)
#sys_web.console.log Text(#Carousel1.currentItem.entry.asString)
#Button1.visible := (*Not (#Carousel1.currentItem.Entry = 1))
#Button2.visible := (*Not (#Carousel1.currentItem.entry = #Carousel1.items.itemcount))
Endroutine
End_Com
It seems the itemRealized event is only firing once, sometimes twice? And yeah, I have the designCreation property set to OnViewing.
This seems really simple, but the event seems to be firing once or twice and then never again.
Any ideas?

- z
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Carousel.ItemRealizing

Post by Stewart Marshall »

It looks as though there's an issue with Carousel. Please report this to your regional help desk

The simple work around is to manage the "CurrentItem" yourself.

Assuming a design instance per page, something like the following should work

Code: Select all

Mthroutine Name(ShowItem)
Define_Map For(*Input) Class(#Prim_nmbr) Name(#Item)

#CurrentItem := #Item

#Carousel.MoveToItem( #CurrentItem )

#Previous.Enabled := #CurrentItem > 1
#Next.Enabled := #CurrentItem <> #Carousel.Items.ItemCount

Endroutine

Evtroutine Handling(#Next.Click)

#com_owner.ShowItem( (#CurrentItem + 1) )

Endroutine

Evtroutine Handling(#Previous.Click)

#com_owner.ShowItem( (#CurrentItem - 1) )

Endroutine
Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
Post Reply