[futurebasic] Re: Building window invisibly

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Tue, 23 Dec 1997 21:04:45 -0400
>Ken asked:

>Question 1:
>
>I'm sure this has been addressed before, but could someone help me
>understand the concept of building a window invisibly. On Page 81, the
>Handbook says to make a window invisible, you change the ID to negative,
>and then restore it to positive to make it visible again. I have done this
>in the example below, but the window contents are gone when the positive ID
>is restored.
>
>I have a splash screen calling a PICT resource that I would like to build
>invisibly on launch before it's displayed, but I can't get the thing to
>work in the background.
>
>'-------------- Begin Program ---------------
> SNIP
> SNIP
>
>DO
>UNTIL FN BUTTON
>'-------------- End Program -----------------

> Try this:

> DO
>     HANDLEEVENTS
> UNTIL FN BUTTON

> Works now!!!

> Scott


Thanks, Scott. "HANDLEEVENTS" works in the simple demo, but not in the
actual application code below. The splashScreen still doesn't work,
although the "About..." screen under the apple menu now does build in the
background.

I'm still doing something wrong, but I am making progress.

Any more suggestions.

Ken

'--------------Constants ---------------
_mAppleMenu = 255

EDIT = 5
'--------------Globals------------------
DIM gProgramEnds
END GLOBALS

'--------------Functions----------------
LOCAL FN splashScreen
  WINDOW #-1,"",(0,0)-(400,250),_dialogFrame
  EDIT FIELD #1, "Please help me build this window
invisibly!",(50,50)-(350,65),_statFramed,_centerJust
  EDIT FIELD #2, "This is giving me a major
pain.",(50,85)-(350,100),_statFramed,_centerJust
  EDIT FIELD #3, "Any and all help is
appreciated.",(50,125)-(350,140),_statFramed,_centerJust
  EDIT FIELD #4, "I have faith.",(50,160)-(350,175),_statFramed,_centerJust
  WINDOW #1
END FN

LOCAL FN buildWnd
  TEXT _geneva, 12
  WINDOW #2, "Main Program Window", (0,0)-(275,100),_docNoGrow
  MENU 1,0, _enable, "File"
  MENU 1,1, _enable, "/QQuit"
  APPLE MENU "About Building Window Invisibly...."
  EDIT FIELD #1, "Click close box to quit.",(0,35)-(275,60),_statNoFramed,
_centerJust
END FN

LOCAL FN doDialog
  evnt = DIALOG(0)
  id = DIALOG(evnt)
  SELECT evnt
    CASE _wndClose
      WINDOW CLOSE #2
      gProgramEnds = true
  END SELECT
END FN

LOCAL FN doMenu
  menuID% = MENU(_menuID)
  itemID% = MENU(_itemID)
  IF menuID% = 1 AND itemID% = 1 THEN END
  IF menuID% = 255 FN splashScreen
  MENU
END FN

LOCAL FN doMouse
  msEvnt% = MOUSE (0)
  LONG IF ABS(msEvnt%) = _click1
    WINDOW CLOSE#1
  END IF
END FN

'-------------Main----------------
WINDOW OFF
COORDINATE WINDOW
FN splashScreen
DELAY 4000
WINDOW CLOSE #1

ON DIALOG FN doDialog
ON MENU FN doMenu
ON MOUSE FN doMouse

FN buildWnd

DO
  HANDLEEVENTS
UNTIL gProgramEnds

___________________________________________________________________
Ken Shmidheiser                     Systems Administrator/Publisher

Internet: kshmidheiser@...    Fax:  606.878.7400
Somerset, KY 42502-0221                        Phone:  606.679.4266
___________________________________________________________________