May 09, 2024, 05:14:41 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Forward Declarations

Started by Bruce Peaslee, November 11, 2007, 09:54:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

I have been fooling around with EBasic as that's where most of the action is these days. It reminds me of the good old days of IBasic Pro. (Only better)

I do have one question, though. I would like to be able to put the handlers for windows and dialogs right after the window or dialog declarations to enhance readability of the code. When I try this I get compile errors because there are references to yet undeclared windows or routines.


Dialog d1
CreateDialog d1, ..., &d1_handler
...
Sub d1_handler
...
Window main
OpenWindow main, ..., &main_handler
...
Sub main_handler




Is there some way to "forward declare" (if that's the right term) to avoid this?

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

My only guess would be to put all your required declarations in an .inc file and put it at the top of your program.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

There shouldn't be any problems with the handlers, I do that all the time.  In fact most of the examples have the variable, followed by the OPENWINDOW statement, followed by all of the subroutines.

Do you have anything more specific?

Ionic Wind Support Team

Bruce Peaslee

The current code is too big. Let me put together an example later today.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Bruce Peaslee

Here is what I was attempting:


Autodefine "off"

DIALOG d1
CREATEDIALOG d1,0,0,300,202,0x80C80080,wMain,"Test Dialog",&d1_handler

SUB d1_handler
   Return
ENDSUB

Window wMain
OpenWindow wMain, 0, 0, 900, 470, @MINBOX, null, "Test Window", &wMain_handler

WaitUntil wMain = 0
End

Sub wMain_Handler

   Select @Message
      Case @IDCLOSEWINDOW
         CloseWindow wMain
   EndSelect
EndSub
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

That's why DoModal and ShowDialog have an optional 'parent' parameter.   So you don't have to specify it in the CREATEDIALOG statement.

Paul.
Ionic Wind Support Team

Bruce Peaslee

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles