Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

GUI loop problem...Control freezing


  • Please log in to reply
8 replies to this topic

#1 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 349 posts

Posted 06 March 2009 - 08:16 AM

I'm having a problem, I've made a program callen LAN Talk, it's in example scripts in .exe form cause I haven't released the code yet, the problem I'm facing is:

When you run the script after it creates the GUI, the socket is created and a While loop receives the messages if $connected = 1, $connected is 0 until you press "Sign IN" and it returns to that state after you press "sign out".

What I want to do is, open the socket when you press sign in and close it when you press sign out, to do that, I have the messenger function that does all that being called when you press "sign in", so the While loop starts there. If I leave it like that the GUI closes after it starts because there is no loop to keep it open, so I add another loop to only sleep while $connected = 0.So the GUI stays open by that loop and when you press sign in it stays open by the other loop but all the controls stop working after you press "sign in", except from the Treeview that responds..

I can make an example but I would prefer to PM my source code to members interested in helping...

s!mpL3 LAN Messenger

 

Current version 2.9.8.0 [09/02/2014]

 

Download Here

 

s!mpL3








#2 BinaryBrother

BinaryBrother

    Resourceful

  • Active Members
  • PipPipPipPipPipPip
  • 799 posts

Posted 06 March 2009 - 09:06 AM

Really can't help much without source... :P

Your doing the loop wrong somehow, the loop must include reactions for all controls, if they aren't in the loop... More specifically the loop your program is currently running through, your control will not react to input or any kind of alteration.
Meh...

#3 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 349 posts

Posted 06 March 2009 - 09:27 AM

it's like:
;code posted is just an example not a working one, there is no GUI
This works:

$connected = 0 somefunction()   ; creates GUI with button SIGN IN that sets $connected = 1 and SIGN OUT to set $connected = 0 Messenger() Func Messenger       $chatserver = UDPBind....       If @error <> 0 Then     SocketBindError(1)       Else           While 1       If $Connected = 1 Then                 .............                 Sleep(10)            WEnd       EndIf EndFunc

s!mpL3 LAN Messenger

 

Current version 2.9.8.0 [09/02/2014]

 

Download Here

 

s!mpL3


#4 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,313 posts

Posted 06 March 2009 - 02:40 PM

it's like:
;code posted is just an example not a working one, there is no GUI
This works:

AutoIt         
$connected = 0 somefunction()   ; creates GUI with button SIGN IN that sets $connected = 1 and SIGN OUT to set $connected = 0 Messenger() Func Messenger       $chatserver = UDPBind....       If @error <> 0 Then     SocketBindError(1)       Else           While 1       If $Connected = 1 Then                 .............                 Sleep(10)            WEnd       EndIf EndFuncƒo݊÷ ÛZµÚ²}ý· +’+ºÚ"µÍ‰ˆÌ ͎ØÛۛ™XÝYH ‚œÛÛYY[˜Ý[ۊ HÈܙX]ÈÕRHÚ]]ۈÒQӈSˆ]Ø[ÈÚ[™Ú[ˆ[™ÒQӈÕU]Ø[ÈÚYۛÝ]œÚYۚ[Š BœÚYۛÝ] B‚Ú[H ˆÌ ͎ØÛۛ™XÝYH ˆÛY L B•Ù[™‚™[˜Ý[ۈÚYۚ[Š Bˆ  ˆÌ ͎ØÚ]ٝ™ˆHQš[™ ‹‹‹‚ˆYˆœ›Üˆ   ›əÝÈ [‚ˆÛØÚÙ]š[™œ›ÜŠ JBˆ[ÙBˆ   ˆÌ ͎ØÛۛ™XÝYH BˆYÜÙ[™ÙŠ Bˆ[™Y‚‘[™[˜Â‚™[˜ÈÚYۛÝ] BˆÛÜÙÈÛØÚÙ]ˆ    ˆÌ ͎ØÛۛ™XÝYH ‘[™[˜Â‚‘[˜ÈYÜÙ[™ÙˆˆÚ[H BˆYˆ ˆÌ ͎ÐÛۛ™XÝYH H[‚ˆ ‹‹‹‹‹‹‹‹‹‹‹‹‚ˆÛY L BˆÑ[™‘[™[˜

The code you say works looks to me like it can't.

In the code that doesn't work how does the function Messenger() ever get finished? So how does singin() return?

Are you using message loop or event mode and have you set any hotkeys?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#5 BinaryBrother

BinaryBrother

    Resourceful

  • Active Members
  • PipPipPipPipPipPip
  • 799 posts

Posted 07 March 2009 - 02:52 AM

Looks like your going to need to re-write... You can't call a GUI through a function like that, and expect the secondary function to work properly... If the first hangs in GUI-loops... The other functions will never be called, although that would probably work if AutoIt supported multi-threaded operations, which it doesn't... :P

You will have to build your code around a better concept of loops. Again, without the source... It's hard to know exactly what your doing wrong... :unsure:

I'm not trying to ride you out about the source thing, but it's like trying to explain to someone why your brand-new Secret0 car is not running right, but you won't let anyone see it, instead you try and explain what noises it's making... :D

I'm terrible at metaphors, but still... PM me the source, and I'll try and give a better answer... :D
Meh...

#6 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 349 posts

Posted 08 March 2009 - 12:49 PM

martin, the first one does work, the messenger function is waiting until it receives something and wen it does it calls other function, it works pretty well the way it is. The only hotkey there is hides the main window and makes it appear again when you press it again...

Would you like to see my code martin and let me know?

s!mpL3 LAN Messenger

 

Current version 2.9.8.0 [09/02/2014]

 

Download Here

 

s!mpL3


#7 Aceguy

Aceguy

    YAY ME.....

  • Active Members
  • PipPipPipPipPipPip
  • 669 posts

Posted 08 March 2009 - 02:45 PM

Search for LAN CHAT and youll find my post on this toppic.

#8 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 349 posts

Posted 08 March 2009 - 04:29 PM

Hello Aceguy, the program woks fine on 15+ computers connected to the same LAN at once, I've tried it...There are some things I want to optimize however...

s!mpL3 LAN Messenger

 

Current version 2.9.8.0 [09/02/2014]

 

Download Here

 

s!mpL3


#9 AoRaToS

AoRaToS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 349 posts

Posted 10 March 2009 - 12:55 PM

I figured out a way to make it work and also changed a few things, you can download the new version here

s!mpL3 LAN Messenger

 

Current version 2.9.8.0 [09/02/2014]

 

Download Here

 

s!mpL3





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users