Page 1 of 1

RapaGUI Textentry Bug

Posted: Fri Nov 22, 2024 3:29 pm
by Redlion
I am trying to write a program that has a Password to login, I can get it to work when entering the password in a Textentry object and then pressing the Login button. If the password is invalid, it clears the Textentry object and sets it as the ActiveObject, all good. But when I have Notify="Acknowledge" set for the Textentry object, enter a in valid password and press return/enter, it does not work like clicking the Login button.

Here is the simplest code I could make that reproduces the error.

Code: Select all

;*** This script requires the RapaGUI plugin ******************************************************
@REQUIRE "RapaGUI"

;*** Setup GUI **************************************************************************************
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
    <window Id="main" width="1024" height="768" margin="10" Open="false">
        <hgroup color="#607BAA">
            <button Id="end_main"> OK </button>
        </hgroup>
    </window>

     <window Title=" LOGIN" Width="300" Id="pswd" Margin="10" Open="False" 
        Closegadget="False" MinimizeGadget="False" MaximizeGadget="False" SizeGadget="False">
        <vgroup color="#608CAF">
            <vspace Height="10"/>
            <hgroup>
                <hspace Width="20"/>  
                <vgroup Padding="10" Spacing="5">
                    <text Align="Center" Fontsize="big"> Please enter your Password </text>
                    <hgroup>
                        <text Align="Left" Fontsize="big">Password : </text>
                        <textentry Id="logapp" Password="1" Notify="Acknowledge" Fontsize="big" Weight="250"></textentry>
                    </hgroup>
                </vgroup>
                <hspace Width="20"/>
            </hgroup>
            <vgroup>
                <vspace Height="10"/>
                <hline/>
                <vspace Height="10"/>
            </vgroup>
            <vgroup>
                <vspace Height="2"/>
                <hgroup>
                    <hspace Width="10"/>
                    <button Id="logOK" notify="Pressed" weight="50" fontsize="big"> LOGIN </button>
                    <hspace Width="40"/>
                    <button Id="logcancel" notify="Pressed" weight="50" fontsize="big"> CANCEL </button>
                    <hspace Width="10"/>
                </hgroup>
                <vspace Height="5"/>
            </vgroup>
        </vgroup>
    </window>

</application>
]])

;*** Handler for all incoming events **************************************************************
Function E_EventFunc(msg) 
    Switch msg.action
        Case "RapaGUI"
            Switch msg.attribute
        
                Case "CloseRequest": ; ============================================================
                    Switch msg.id
                        Case "main"                                            
                            End

                    EndSwitch

                Case "Pressed": ; =================================================================
                     Switch msg.id
                        Case "end_main"
                            End

                        Case "logOK"
                            Password$ = moai.Get("logapp", "Text")
                            If Password$ = Login$
                                moai.Set("pswd", "Open", False) 
                                moai.Set("main", "Open", True)
                            Else
                                PTry = PTry + 1
                                moai.Request(" INCORRECT LOGIN ! ",
                                             " You entered an invalid Password." .. 
                                             "\n You have only ".. (4 - PTry).. " tries left.","OK")
                                moai.Set("logapp", "Text", "")
                                If PTry = 4
                                   END
                                EndIf  
                                moai.Set("pswd", "Activeobject", "logapp")
                            EndIf

                        Case "logcancel"       
                            End

                     EndSwitch

                 Case "Acknowledge": ; =============================================================
                    Switch msg.id
                        Case "logapp"
                            Password$ = moai.Get("logapp", "Text")
                            If Password$ = Login$
                                moai.Set("pswd", "Open", False) 
                                moai.Set("main", "Open", True)
                            Else
                                PTry = PTry + 1
                                moai.Request(" INCORRECT LOGIN ! ",
                                             " You entered an invalid Password." .. 
                                             "\n You have only " .. (4 - PTry) .. " tries left.", "OK")
                                moai.Set("logapp", "Text", "")
                                If PTry = 4
                                   END
                                EndIf  
                                moai.Set("pswd", "Activeobject", "logapp")
                            EndIf

                    EndSwitch

              EndSwitch

        EndSwitch
EndFunction

;*** listen to these events ***********************************************************************
InstallEventHandler({RapaGUI = E_EventFunc})

Login$ = "Amiga"

moai.Set("pswd", "Open", True)
moai.Set("pswd", "Activeobject", "logapp")

;*** main loop ************************************************************************************
Repeat
    WaitEvent
Forever
Once I enter an incorrect password and press enter it will tell me how many trys I have left, press the OK button on the error message, and the Textentry object clears and I can enter about 2 letters before the cursor disappears.

I have tried turning Off notifications but that made no difference. Adding in the Requester seem to help a bit but it still did not work like hitting the Login button.

I have spent a lot of time trying all sorts of work arounds but with no joy.

Hope I have explained it good enough for you.

Cheers
Leo

Re: RapaGUI Textentry Bug

Posted: Fri Nov 22, 2024 7:34 pm
by plouf
i haev try your example in win11 and 68k
i Type "Amiga" then Enter, and get login (message OK appear) ?!

Re: RapaGUI Textentry Bug

Posted: Sat Nov 23, 2024 3:02 am
by Redlion
@ plouf

It works if you put in the correct password, try it with an incorrect password.

Cheers
Leo

Re: RapaGUI Textentry Bug

Posted: Mon Nov 25, 2024 8:57 am
by jPV
I can't see any difference if I do it by the button or the enter key. On which platform you see the issue?

Re: RapaGUI Textentry Bug

Posted: Mon Nov 25, 2024 8:02 pm
by plouf
ok i see it now

ORIGINAL textentry has focus WHILE you are typing (letter 1 letter 2 etc)
AFTER error message, AFTER the first letter the focus is lost

happens is AOS 3 / AOS 4 / NOT IN WINDOWS

i have minimize code to the minimun to demostrate

Code: Select all

;*** This script requires the RapaGUI plugin ******************************************************
@REQUIRE "RapaGUI", {link=True}

;*** Setup GUI **************************************************************************************
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">

     <window Title="LOGIN" Width="300" Id="pswd" >
        <vgroup >
                        <text Align="Left">Password : </text>
                        <textentry Id="logapp"  Notify="Acknowledge"></textentry>
        </vgroup>
    </window>

</application>
]])

;*** Handler for all incoming events **************************************************************
Function E_EventFunc(msg) 
    Switch msg.action
        Case "RapaGUI"
            Switch msg.attribute
        
                 Case "Acknowledge": ; =============================================================
                    Switch msg.id
                        Case "logapp"
                            Password$ = moai.Get("logapp", "Text")
                            If Password$ = Login$
                                moai.Request(" CORRECT","","ok")
																End
                            Else
                              moai.Request(" INCORRECT LOGIN ! ","", "OK")
                              moai.Set("logapp", "Text", "")
                            EndIf
												
                    EndSwitch
							
              EndSwitch

        EndSwitch
EndFunction

;*** listen to these events ***********************************************************************
InstallEventHandler({RapaGUI = E_EventFunc})

Login$ = "Amiga"

moai.Set("pswd", "Activeobject", "logapp")

;*** main loop ************************************************************************************
Repeat
    WaitEvent
Forever


Re: RapaGUI Textentry Bug

Posted: Mon Nov 25, 2024 8:31 pm
by jPV
Doesn't happen on MorphOS. Which MUI version you have in OS3?

Re: RapaGUI Textentry Bug

Posted: Mon Nov 25, 2024 8:41 pm
by plouf
os3 (old amikit winuae) mui5 / 21.227 / 31.08.2021
os4 21.1 / 29.08.2016

i try in mos, yes MorphOS / windows are both Working ok

Re: RapaGUI Textentry Bug

Posted: Mon Nov 25, 2024 9:36 pm
by jPV
Someone should try with MUI 3.8 on OS3. If it works, then it's a bug in the AmigaOS MUI5 clone...

Re: RapaGUI Textentry Bug

Posted: Mon Nov 25, 2024 9:55 pm
by plouf
seems you are right...
i found a AiaB r10 with mui 3.9 and it is working properly..

Re: RapaGUI Textentry Bug

Posted: Sat Nov 30, 2024 10:41 pm
by airsoftsoftwair
MUI5 bugs can be reported here: https://github.com/amiga-mui/muidev/issues