It works as intended but with a slight issue ...
I was trying to be clever and have the send button disable and grey out when pressed, this was so that after pressing the send button, the program would move on to the main procedure mainprog() to actually send the password and stop the send button being pushed multiple times. The problem was that the button did not grey out or disable until the mainprog() finished and returned to the main waitwindow event, the only way I could come up with a solution was to introduce a loop delay, that would loop within the waiteventwindow to give time for the window to redraw before moving on to the mainprog() procedure. This does not work on all systems, timing, CPU etc.
Code: Select all
If Event = #PB_Event_CloseWindow Or GetGadgetState(Button_1)=1 Or sent>=lpdel
DisableGadget(button_0,0)
SetGadgetState(button_0,0)
tb.s=""
MainProg() ; call main program procedure that kicks of the actual sending of the password
EndIf
Basically I am really struggling to have the send button grey out and disable before moving on to the mainprog() and then re-enable.
Any ideas, I hope I am making sense
I have this at the start of the waitwindow loop :-
Code: Select all
Event = WaitWindowEvent() ;Wait for a Window event
If sent>0 And sent<lpdel ;sent is set to 1 if Send button is pressed or hotkey key is used, this starts off a counter from 1 to the value of lpdel (This loop delay forces the main window loop routine to repeat (only fix I could come up with to make the gadget update state in the window before exiting main loop to run mainprog()
sent=sent+1
EndIf