Author Topic: Add Loading Spinner to Recipe Load / Recipe Save Button?  (Read 3421 times)

PLCHorse

  • Newbie
  • *
  • Posts: 22
    • View Profile
Add Loading Spinner to Recipe Load / Recipe Save Button?
« on: September 16, 2024, 09:12:32 AM »
The Recipe Load and Recipe save button is working Excellent!

I am using it to write 1101 Integers, and one string.

Is there any way to make it show some kind of loading spinner?

PLCHorse

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #1 on: September 18, 2024, 01:24:43 PM »
So what ive noticed is the recipe buttons: if it takes a long time to load or save and someone hits the button multiply due to very little indication of anything happening: then they might hit the button 3 times or 4 or 10, causing 10 recipe loads.

bachphi

  • Hero Member
  • *****
  • Posts: 667
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #2 on: September 18, 2024, 03:50:40 PM »
My suggestion is to consider visible properties.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

PLCHorse

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #3 on: September 18, 2024, 04:25:03 PM »
You mean make the button invisible after it gets clicked? Ok that sounds plausible but how can i detect in the plc that the recipe load /save  is in progress such to make it invisible

bachphi

  • Hero Member
  • *****
  • Posts: 667
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #4 on: September 18, 2024, 04:38:54 PM »
You can initially set the visibility to
Code: [Select]
False, and then make it visible again at the end
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #5 on: September 18, 2024, 04:47:13 PM »
Another option could be to use the enabled property and disable the button, maybe change its text to something else while it is disabled.

See this topic and its "Event - Mouse Down" section that disables the button (Reply #6):

  https://www.advancedhmi.com/forum/index.php?topic=1562.msg8438#msg8438


PLCHorse

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #6 on: October 01, 2024, 05:32:52 PM »
Another option could be to use the enabled property and disable the button, maybe change its text to something else while it is disabled.

See this topic and its "Event - Mouse Down" section that disables the button (Reply #6):

  https://www.advancedhmi.com/forum/index.php?topic=1562.msg8438#msg8438

thank you for the help:

Hm, i tried this and it worked well but only for the recipe save button. The recipeButton does not disappear.

In : RecipeButton.vb this is where I put my code: I tried several areas in this sub, nothing seemed to do the trick.

Code: [Select]
#Region "Events"
    Private m_savedText As String = ""
    Protected Overrides Sub OnClick(e As EventArgs)
        MyBase.OnClick(e)
        Me.Visible = False

        '* Make sure an INI file was specified
        If Not String.IsNullOrEmpty(m_IniFileName) Then
            If String.IsNullOrEmpty(RecipeFileError) Then
                If m_ComComponent IsNot Nothing Then
                    For i = 0 To Settings.Count - 1
                        Try
                            m_ComComponent.Write(Settings(i).PLCAddress, Settings(i).Value)
                        Catch ex As Exception
                            System.Windows.Forms.MessageBox.Show("Faile to write " & Settings(i).Value & " to " & Settings(i).PLCAddress & " ." & ex.Message)
                        End Try
                    Next
                Else
                    System.Windows.Forms.MessageBox.Show("ComComponent Property must be set.")
                End If
            Else
                System.Windows.Forms.MessageBox.Show("INI File Error - " & RecipeFileError)
            End If
        End If
        Me.Visible = True
    End Sub
« Last Edit: October 01, 2024, 05:40:42 PM by PLCHorse »

PLCHorse

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #7 on: October 02, 2024, 08:57:43 AM »
Me dum dum. Works perfectly now. thanks lots.

Was modifying "recipe button" vb but not "recipe SELECT" vb.

Apes, together strong.

bachphi

  • Hero Member
  • *****
  • Posts: 667
    • View Profile
Re: Add Loading Spinner to Recipe Load / Recipe Save Button?
« Reply #8 on: October 02, 2024, 12:51:16 PM »
It might be beneficial for Archie to implement an on/off 'ENABLE' for the Recipe button in AAHMI, as the process of saving a recipe can be time-consuming.

Quote
Take your stinking paws off me, you damned dirty ape!
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================