Checking the Resize Window Event

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by PB

> Just changed PB's code to use CallBack.

Thanks, Benny. I've reposted your changes to my original tip in the
"Tips 'N' Tricks" section, along with a credit to you. :)

PB - Registered PureBasic Coder
Thanks PB ...25 messages... do i get a Star now :)

Its just, my old GFA Basic used another way for handling events.
It looks like this. (sub is just 'procedure')

Code: Select all

sub win_1_lButtonUp
  ; mouse pressed
End Sub
Sub button1_Click
  ; do the stuff..
End Sub
Sub text_Changed
  ; text of gadget has been edited.
End Sub
So in a bigger app, with hundreds of messages to handel, you got an enormous amount of procedures.....
This is wy i start using callback, to get some overview...and explains also why i like the 'procedure folding' so much.


Regards,

Benny aka Beriko


http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Joseph.

Thanks All for your *very helpful* replies
By the way, your code works fine on my Win XP Home edition system

with reference to my original post, just another question: what's the #PB_Event_SizeWindow EventiID purpose?

thanks again

best regards
Joseph

(PureBasic Registered User)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by Joseph

Thanks All for your *very helpful* replies
By the way, your code works fine on my Win XP Home edition system

with reference to my original post, just another question: what's the #PB_Event_SizeWindow EventiID purpose?
It is so your application can be notified when your window is resized. Not all applications need to use callbacks, so using the event that PureBasic provides is simpler. Also, remember that all PureBasic commands need parentheses after the name, not just "EventID" as you showed in your original post.


--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.30)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Joseph.

tinman thank you for your reply
well, I read about the parentheses need just for functions, anyway the snippet i enclosed above was just extracted from the 'Window.pb' sample, something like the following

Code: Select all

Repeat
    EventID.l = WaitWindowEvent()

    If EventID = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf
    
    ; added
    If EventID = #PB_Event_SizeWindow  ; If the user resizes the window
      ; just to test
      IsSizing = 1
    EndIf
    
  Until Quit = 1
also, it's ok that #PB_Event_SizeWindow purpose is so that my application can be notified when the window is resized, but actually that's why on my original post i was asking why the snippet based on #PB_Event_SizeWindow doesn't seem to work at all (at least on my win XP system)
I appreciate very much the callback solution posted here (as i said it works fine) but I'd really like also the 'simpler way' if possibile

thank you again

best regards
Joseph

(PureBasic Registered User)
Post Reply