Page 1 of 1

Carousel.ItemRealizing

Posted: Wed Sep 13, 2017 10:12 am
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

Re: Carousel.ItemRealizing

Posted: Wed Sep 13, 2017 3:52 pm
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