Explore the community Forums Lectora Lectora Questions & Answers Change color of objects in Lectora

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #296797 Score: 0
    Profile photo of Mkia
    Mkia
    Member
    beginner
    intermediate
    friend finder
    contributor
    wise owl
    advanced
    curious george
    3 pts
    @Mkia

    Hi,

    i’m trying to figure out if there a way to change the color of an object by using some kind of action.

    For example rectangle is grayish but when the user clicks depending on what was the content of that rectangle it becomes different color.

    Any ideas simpler then having a double rectangle?

    Thanks

    #296829 Score: 2
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    338 pts
    @ssneg

    Use External HTML Object (HTML Extension), set it to Custom DIV, write any code inside. E.g.
    <div id="mydiv1" style="background-color:red; width:333px;height:222px"></div>

    Then you will be able to programmatically change its background with JS:

    document.getElementById('mydiv1').style.backgroundColor = "blue";

    This post has received 2 votes up.
    #296845 Score: 2
    Profile photo of Annette Williams
    Annette Williams
    Member
    beginner
    intermediate
    advanced
    contributor
    LUC16
    LUC16 Attendee
    wise owl
    curious george
    entry
    LUC17 Presenter
    14 pts
    @amwdmw

    I just use two different objects, and use the Change Contents feature…or Show/Hide if the items aren’t the same size.  You can use the “On Mouse Click” action to trigger these events.  🙂

    This post has received 2 votes up.
    #296892 Score: 0
    Profile photo of Mkia
    Mkia
    Member
    beginner
    intermediate
    friend finder
    contributor
    wise owl
    advanced
    curious george
    3 pts
    @Mkia

    Thanks @ssneg and @amwdmw

     

    I have tried change contents already…but it cannot be applied to my objects. I’ve solved it temporarily by having two objects one over the other and the other is transparent so the content is the same and just the frame color changes…but I’m sure there is more elegant way to do this…:))

    Sergey’s way sounds pretty cool if only I would know more about Java…:)) It’s def on my goodtoinvestsometime list! I’ll try to play with it a bit more these days.

     

     

    • This reply was modified 2 years, 3 months ago by Profile photo of Mkia Mkia .
    • This reply was modified 2 years, 3 months ago by Profile photo of Mkia Mkia .
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.