Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Rebol View, function behaving differently when called diectly or from other funtion

From: yvan_iigs::gmx::net at: 25-Aug-2006 17:37

Hello, I have problems with the following REBOL code (I inserted the code at the end of this e-mail). Basically I have the following functions: video-menu: func ["Stripped down GUI for test"] ; GUI with a menu 'create new video' (starts 'create-new-video') create-new-video: func [..see below..] ;some debugging code, should create a video record, starts a function 'Videoform' to ask for video data Videoform: func ["Creates Input form for new video record"] ;opens a window for the user to enter the video data ;and some debugging code to see what happens Now 'create-new-video' works, starting 'create-new-video' from shell: - Windows with fields to enter new video data opens - no output in shell Entering fields in Window and clicking OK button - Window closes - in shell I see the following output
>> create-new-video
true Form ready
This is how I want it, 'create-new-video' executes the following lines: Formfilled: False video-record: Videoform ; here it waits until the OK button of the window in VideoForm is pressed print Formfilled ; Pressing the OK button of VideoForm changed the value of Formfilled to true if Formfilled [print "Form ready"] ; and the form is ready But when I start 'create-new-video' from 'video-menu' the strange things happen: - First a window with a menu opens, when I click on the button 'Create new Video' the now well known function 'create-new-video' is called. - the Form window opens - in the shell you see the output 'false' Now entering values in the form and clicking the OK produces no further output, so 'formfilled' doesn't seem to have changed:
>> video-menu
This is not how I want it, 'create-new-video' should still execute the following lines:: Formfilled: False ;just for debugging video-record: Videoform ; but now it doesn't seem to wait. Why???? print Formfilled ; This line is printed with the value false, why? if Formfilled [print "Form ready"] ; this line is not printed It seems that the 4 lines of code are not executed sequencially????? What the hell is wrong? Here is the complete code: REBOL [] video-menu: func ["Stripped down GUI for test"] [ view layout [text "Video DB Main Menu" text "Click on of the following selections" button 400x20 "Create new Video" [create-new-video] button 400x20 "Quit Video DB" [quit] ] ] create-new-video: func [ "Asks user for data and creates new Video Record. Last part missing for test purpose" /local video-record [block!] ] [ Formfilled: False ;just for debugging video-record: Videoform print Formfilled if Formfilled [print "Form ready"] ] Videoform: func ["Creates Input form for new video record"] [ Formular: view layout [ text "Title" FTitel: field text "Producer" FProduzent: field button #"^M""OK" [OK: TRUE ;Title has to be entered if (empty? FTitel/text) [ OK: FALSE FTitel/edge: make FTitel/edge [color: red] focus FTitel ] if OK [ Formfilled: true unview ] ] ] ; Missing return code ]