It is currently Wed Jun 19, 2013 8:28 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: End in CallBack [Resolved]
PostPosted: Fri Jun 15, 2012 4:28 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 2532
Location: Lyon - France
Hello at all

Is it dangerous to put a END in a CallBack ??
I have try, that's works but is it safe ??

Thanks

_________________
ImageThe happiness is a road...
Not a destination


Last edited by Kwaï chang caïne on Fri Jun 15, 2012 8:40 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: End in CallBack
PostPosted: Fri Jun 15, 2012 4:47 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4740
Location: Berlin - Germany
The question is, who calls the callback?
On PB-Code only without using a dll or api it should sure, in regular programming :mrgreen:

So i think, better not use end in a callback.

Greetings - Thomas

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 15 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: Re: End in CallBack
PostPosted: Fri Jun 15, 2012 4:56 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9859
Location: Beyond the pale...
Kwaï chang caïne wrote:
Hello at all

Is it dangerous to put a END in a CallBack ??
I have try, that's works but is it safe ??

Thanks


Safer than sticking your head in a lion's mouth, but only marginally more desirable!

:)

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: End in CallBack
PostPosted: Fri Jun 15, 2012 5:08 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 2532
Location: Lyon - France
@TSSOFT
Thanks TsSoft for your quick answer 8)

In fact it's in a big code ...so big...even me i'm lost in it :oops: :lol: :lol:

I have a window with animation inside
And the only way i found for catch a right click on it, it's use callback

At the beginning i have put a variable to #true for quit the program
And take a look on this variable for see if she is at true for quit

This an example a little bit like my code, but in simple
Code:
Global Quit

Procedure WinCallback(WindowID, Message, wParam, lParam)
 
 Result.l = #PB_ProcessPureBasicEvents
 
 If Message = #WM_SIZE
 
   Select wParam
   
   Case #SIZE_MINIMIZED
     MessageRequester( "info", "minimizé", 0)
     HideWindow(1, 0)
   Case #SIZE_MAXIMIZED
     MessageRequester( "info", "maximizé", 0)
   Case #SIZE_RESTORED
     MessageRequester(" info", "restoré", 0)
   EndSelect
   
  ElseIf Message = #WM_RBUTTONDOWN
     
   Reponse = MessageRequester("", "Do you want to quit ?", #PB_MessageRequester_YesNo)
       
   If Reponse = 6
    Quit = #True
   EndIf
         
  EndIf
   
  ProcedureReturn Result
 
EndProcedure


If OpenWindow(0, 0, 0, 300, 300, "CallBack", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
 
 SetWindowCallback(@WinCallback())

 Repeat
  Event = WaitWindowEvent()
   
 Until Event = #WM_CLOSE Or Quit
 
EndIf


But the CallBack is more faster and she run several time before the event see the value of Quit
So i do like this, put the END inside the Callback

Code:
Procedure WinCallback(WindowID, Message, wParam, lParam)
 
 Result.l = #PB_ProcessPureBasicEvents
 
 If Message = #WM_SIZE
 
   Select wParam
   
   Case #SIZE_MINIMIZED
     MessageRequester( "info", "minimizé", 0)
     HideWindow(1, 0)
   Case #SIZE_MAXIMIZED
     MessageRequester( "info", "maximizé", 0)
   Case #SIZE_RESTORED
     MessageRequester(" info", "restoré", 0)
   EndSelect
   
  ElseIf Message = #WM_RBUTTONDOWN
   
   Reponse = MessageRequester("", "Do you want to quit ?", #PB_MessageRequester_YesNo)
       
   If Reponse = 6
    End
   EndIf
         
  EndIf
   
  ProcedureReturn Result
 
EndProcedure


If OpenWindow(0, 0, 0, 300, 300, "CallBack", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
 
 SetWindowCallback(@WinCallback())

 Repeat
  Event = WaitWindowEvent()
 Until Event = #WM_CLOSE
 
EndIf



@SROD
Oooooh SROD is here too :shock:
Very very very glad to can talk to you since all this time :D
You got me scared with your disease :(
A little bit like a man who lost his head....because you remember in the team...i'm the legs :oops: (And again, I am polite, because I'm rather the asshole) :mrgreen: :lol:

Quote:
Safer than sticking your head in a lion's mouth, but only marginally more desirable!
:lol:
I see you not lost your humor.....
Apparently..the answer is Image

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
 
 Post subject: Re: End in CallBack [Resolved]
PostPosted: Fri Jun 15, 2012 8:42 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 2532
Location: Lyon - France
Thanks at you two for your precious answer 8)
Have a good week end :D

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: uwekel and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye