|
Pages: [1]
|
 |
|
Author
|
Topic: Problems with both VID and RebGUI (Read 146 times)
|
|
fhein
|
I've got some problems with both VID and RebGUI when I'm using popups. It's basically the same code but one version for RebGUI and the other is VID only. RebGUI: print "bugz" do %rebgui/rebgui.r
maingui: [ text "Hello" return button "Start!" [ display-next-word ] ]
count: 0
secondgui: does [ compose [ text (join "popup nr " count: count + 1) return button "next" [ display-next-word ] ] ]
display-next-word: make function! [] [ hide-popup display/dialog "Go!" secondgui ]
display "word!" maingui do-events halt
Working as intended: (1) Close window - Program is halted. (2) Press start button to open a popup, close both windows. (3) Open a popup, press next once and close both windows. Bug: Press start button, press next twice (it should say popup nr. 3). Close both windows. Program is stuck in do-events and never halted. VID: print "bugz"
maingui: layout [ text "Hello" button "Start!" [ display-next-word ] ]
count: 0
secondgui: has [ spec ] [ spec: layout compose [ text (join "popup nr " count: count + 1) button "next" [ display-next-word ] ] spec/type: 'popup spec/text: "popup" spec ]
display-next-word: make function! [] [ hide-popup show-popup secondgui ]
view maingui do-events halt
Working as intended: Press start button, then "next" any number of times. Close both windows. Bug: Close main window without opening any popups. Program is stuck in do-events. Help please! 
|
|
|
|
|
Logged
|
|
|
|
|
btiffin
|
Haven't looked real close but with VID, VIEW function includes the wait (do-events) so take out the second last line or look into view/new.
Just noticed that at a glance
Cheers, Brian
|
|
|
|
|
Logged
|
|
|
|
|
fhein
|
You're right.. Still can't figure this one out though.. If I change show-popup to inform, atleast I can get the same behaviour from RebGUI and VID.. print "bugz"
maingui: layout [ text "Hello" button "Start!" [ display-next-word print "First popup done" ] button "Quit!" [ unview/all ] ]
count: 0
secondgui: has [ spec ] [ spec: layout compose [ text (join "popup nr " count: count + 1) button "next" [ display-next-word print "Chained popup done" ] ] spec/type: 'popup spec/text: join "popup " count spec ]
display-next-word: make function! [] [ hide-popup inform secondgui
; show-popup secondgui ; do-events ]
view maingui print "main-done" halt
Works up to popup nr 2, but it won't terminate as supposed to if you go to nr. 3 ---- EDIT: Added some print lines and sourced "inform" which made me realize it's basically the same as show-popup + do-events. I managed to solve the problem by removing all do-events, inform and view in the main code. Instead I added a quit flag, triggered by main windows quit button, and looped do-events until it was set. Is View working as intended, and it was all my fault? Somehow I think I should be allowed to code like this, since I did call hide-popup before opening a new one.
|
|
|
|
« Last Edit: March 22, 2008, 01:33:59 PM by fhein »
|
Logged
|
|
|
|
|
fhein
|
Maybe I can trigger an event before hiding the old popup, so that the previous call do display-next-word gets to finish? Anyone have some good resources on event handling? 
|
|
|
|
|
Logged
|
|
|
|
|
btiffin
|
Sorry; I still haven't tried your code out. There is no event generator in R2. You can't make event! to trigger the gui; but you can try a rate: timer and then add the feel. view layout [button "Watch Console" rate 00:00:01 feel [ engage: func [face action event] [ if action = 'time [print ["timer fired" now/time/precise]] ] ]
But this is a total digression...the above is highly unlikely to be on the path to solution in this case. I'll try and try your code out. For events help, try http://www.musiclessonz.com/rebol.html#section-4.5 Nick has done a lot of good writing  Cheers, Brian
|
|
|
|
|
Logged
|
|
|
|
|
fhein
|
The validity question still stands, but I've dropped using popups/dialogs entirely since it was causing some other problems.
Now I'm trying to simply replace the contents if mywindow/pane with the /pane contents of a new layout, but for some reason RebGUI is autopositioning widgets with #XY span based on the previous window size rather than the new one.
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2163 Posts in 558 Topics by 1228 Members
Latest Member: Laksoxisk
|