Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Problems with both VID and RebGUI
Pages: [1] Print
Author Topic: Problems with both VID and RebGUI  (Read 146 times)
fhein
Newbie
*
Offline Offline

Posts: 47


View Profile
Problems with both VID and RebGUI
« on: March 22, 2008, 08:07:03 AM »

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:
Code:
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:
Code:
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! Tongue
Logged
btiffin
Jr. Member
**
Offline Offline

Posts: 51


View Profile
Re: Problems with both VID and RebGUI
« Reply #1 on: March 22, 2008, 10:54:57 AM »

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
Newbie
*
Offline Offline

Posts: 47


View Profile
Re: Problems with both VID and RebGUI
« Reply #2 on: March 22, 2008, 12:13:04 PM »

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..

Code:
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
Newbie
*
Offline Offline

Posts: 47


View Profile
Re: Problems with both VID and RebGUI
« Reply #3 on: March 22, 2008, 04:26:34 PM »

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? Smiley
Logged
btiffin
Jr. Member
**
Offline Offline

Posts: 51


View Profile
Re: Problems with both VID and RebGUI
« Reply #4 on: March 24, 2008, 01:24:19 AM »

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 Smiley
Cheers,
Brian

Logged
fhein
Newbie
*
Offline Offline

Posts: 47


View Profile
Re: Problems with both VID and RebGUI
« Reply #5 on: March 24, 2008, 03:03:24 AM »

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] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Problems with both VID and RebGUI
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 12, 2008, 02:05:46 AM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2163 Posts in 558 Topics by 1228 Members
Latest Member: Laksoxisk

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc