Page 1 of 1

Very slow when hidding/showing items?

Posted: Thu Mar 30, 2023 5:47 pm
by midwan
I have a function that gets activated when a button is pressed, which is meant to hide or show certain RapaGUI elements according to a boolean value.
Unfortunately, this process seems to be very slow (like a slideshow) on a real 060 Amiga. It works instantly on emulation, so it seems to be heavily CPU-bound.

I've tried adding DisableLineHook() and EnableLineHook() once it's done, but I didn't see much of a difference.

Here's the said function:

Code: Select all

Function p_SetPollStatus()
    DisableLineHook() ; Temporarily disable this, to increase performance
    If poll = True
        ;show relevant area
        moai.Set("txt_poll_choice1", "Hide", False)
        moai.Set("txt_poll_choice2", "Hide", False)
        moai.Set("grp_poll_options", "Hide", False)
        moai.Set("cmb_poll_duration", "Value", "1 day")

        poll_options_num = 2

        ;when a poll is active, media cannot be used
        moai.Set("btn_addmedia", "Hide", True)
    Else
        ;hide relevant area
        moai.Set("txt_poll_choice1", "Hide", True)
        moai.Set("txt_poll_choice2", "Hide", True)
        moai.Set("grp_poll_choice3", "Hide", True)
        moai.Set("grp_poll_choice4", "Hide", True)
        moai.Set("grp_poll_options", "Hide", True)

        ;clear any poll variables
        moai.Set("txt_poll_choice1", "Text", Nil)
        moai.Set("txt_poll_choice2", "Text", Nil)
        moai.Set("txt_poll_choice3", "Text", Nil)
        moai.Set("txt_poll_choice4", "Text", Nil)
        poll_options = Nil
        poll_options_num = 0
        poll_expires = 0
        poll_multi = False

        ;re-enable the Add Choice button
        moai.Set("btn_add_poll_choice", "Disabled", False)

        ;re-enable the media button
        moai.Set("btn_addmedia", "Hide", False)
    EndIf
    EnableLineHook()
EndFunction
Does anyone have any suggestions on how this could be improved?

Re: Very slow when hidding/showing items?

Posted: Thu Apr 13, 2023 3:17 pm
by airsoftsoftwair
Enabling/disabling the line hook certainly won't have any effect here. Can you put the widgets in a group and show/hide the group instead?