[REBOL] Re: [VID] Strange problem

2004-05-23 Thread Carl Read

Hi Arie,

Attachments are stripped with this list.  If possible, just send the script in the 
body of the email, or if it's too large, place it on a website (if you have one) and 
just show us the URL.

-- Carl Read.

Hi all,

currently I am developing a small application that displays flags from 
all over the world off a website.
There is also a search option, in order to search for (a part of) a 
countryname.

The REBOL/View version I use is 1.2.46.3.1.

I have built in some print statements for debugging purposes and to show 
the problem exactly.

Example session:
1. start the app
2. fill out the search field named country-find with the text ur
3. click the Find (next) button
4. change the contents of the search field named country-find to 
the text ne

When you look at the displayed lines, you see (among others):
Right after push Find (next) button:
   global/findstr=(ne)
   country-find/text=(ne)

Apparently global/findstr has changed somewhere between the last hit and 
the press of the Find (next) button.
However, there is only one place where global/findstr is being changed  
AFAIK!

It was my intention that global/findstr would contain the PREVIOUS 
searchstring.

Please see the attached app

Any ideas?

TIA

With kind regards,
Arie van Wingerden

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: [VID] Strange problem

2004-05-23 Thread Arie van Wingerden

Hi Carl and others, below the asterisks line follows the script
*
rebol [
Title:Flag Viewer
Author:Arie van Wingerden
]
   
{write/lines %log mold country-flag}

global: make object! [
;**
; The URL of the webpage holding the names of the different countries
; for which a flag is present.
;**
allflags: 
http://www.cia.gov/cia/publications/factbook/docs/flagsoftheworld.html   
;**
; The URL of the webpage holding an enlarged flag of a certain country.
; Each country has a specific prefix code, like xx.
; The image of the flag is URL/xx-lgflag.gif.
; The flad description can be found in URL/xx-flag.html

;**   
flagpage: http://www.cia.gov/cia/publications/factbook/flags/

;**   
; This field will contain (after get-flags has been called) :
; - the countryname
; - the 2 character countrycode
;**
flags: copy 

;**   
; This field will be used as a pointer to the current flag
; and will be initialized to 1
;**
curflag: 1

;**   
; This field remembers the last find string in order to be able to
; carry on searching with the same string
;**
findstr: copy 

;**   
; This field remembers the pointer to the country last found
;**
findptr: 1
]

get-flags: func [
{Fetch countrynames and codes of all flags needed}
/local countrycode countryname flaglist flags found
][
flags: copy []
parse read global/allflags [
thru option selectedSelect a Country/option
copy flaglist
to /select
to end
]
forever [
found:
parse flaglist [
thru geos/
copy countrycode
to .
thru 
copy countryname
to 
copy flaglist
to end
]
if not found [ break ]
either find [ ay gz oo pf pg we xo xq xx zh 
zn ] countrycode [
{Due to error on website this code points to nowhere
so we ignore this entry for the time being}
][
append flags reduce [ countryname countrycode ]
]
]
;**
; Sort the list by countryname
;**
sort/skip flags 2
;**
; Return the list of countrycodes and names implicitly
;**
flags
]

show-flags: func [
{Main program: show and search for flags}
][
view layout [
country-name: label current-country/name 600 black bold 
font-name font-sans-serif font-size 14
country-flag: image fetch-url
across
country-find: field 400
find-button: button Find (next) [
print 
print Right after push Find (next) button:
print rejoin [global/findstr=( global/findstr ) ]
print rejoin [country-find/text=( country-find/text ) ]
either find-country country-find/text [
country-name/text: current-country/name
country-flag/image: load fetch-url
show country-name
show country-flag   
msg-info/text: copy 
][
msg-info/text: Country could not be found!
]
show msg-info
show country-find
]
next-button: button Next Country [
next-country
country-name/text: current-country/name
country-flag/image: load fetch-url
country-find/text: copy 
msg-info/text: copy 
show country-name
show country-flag
show country-find
show msg-info
]
return
msg-info: info copy  600 yellow
]
]

fetch-url: func [
{Construct the URL of the image}
][
return rejoin [ 

[REBOL] Re: [VID] Strange problem

2004-05-23 Thread Arie van Wingerden

Hi all,

trying to solve my problem I found an error in the argument block of the 
find-country func.

Currently it says:
search-text /count /ptr /tmpflags
but it should be:
search-text /local count ptr tmpflags

But the problem I posted for in the first place is not solved by this patch.

Thanks,
Arie
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: [VID] Strange problem

2004-05-23 Thread Anton Rolls

It is a lack of copy.

global/findstr: copy search-text

or

find-country copy country-find/text 

Anton.

 Hi all,
 
 currently I am developing a small application that displays flags from 
 all over the world off a website.
 There is also a search option, in order to search for (a part of) a 
 countryname.
 
 The REBOL/View version I use is 1.2.46.3.1.
 
 I have built in some print statements for debugging purposes and to show 
 the problem exactly.
 
 Example session:
 1. start the app
 2. fill out the search field named country-find with the text ur
 3. click the Find (next) button
 4. change the contents of the search field named country-find to 
 the text ne
 
 When you look at the displayed lines, you see (among others):
 Right after push Find (next) button:
global/findstr=(ne)
country-find/text=(ne)
 
 Apparently global/findstr has changed somewhere between the last hit and 
 the press of the Find (next) button.
 However, there is only one place where global/findstr is being changed  
 AFAIK!
 
 It was my intention that global/findstr would contain the PREVIOUS 
 searchstring.
 
 Please see the attached app
 
 Any ideas?
 
 TIA
 
 With kind regards,
 Arie van Wingerden

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: [VID] Strange problem

2004-05-23 Thread Arie van Wingerden
 

Hi Anton,

that was the old friend copy again, sigh :-[ 
But still I am very glad that you've made me aware of the problem :-) 

Many thanks for your help!

Kind regards,
Arie van Wingerden

Anton Rolls wrote: It is a lack of copy. global/findstr: copy search-text or
find-country copy country-find/text Anton. Hi all, currently I am developing
a small application that displays flags from all over the world off a
website. There is also a search option, in order to search for (a part of) a
countryname. The REBOL/View version I use is 1.2.46.3.1. I have built in
someprint statements for debugging purposes and to show the problem exactly.
Example session: 1. start the app 2. fill out the search field named
country-find with the text ur 3. click the Find (next) button 4.
changethe contents of the search field named country-find to the text ne
When you look at the displayed lines, you see (among others): Right after
push Find (next) button: global/findstr=(ne) country-find/text=(ne)
Apparently global/findstr has changed somewhere between the last hit and the
press of the Find (next) button. However, there is only one place where
global/findstr is being changed AFAIK! It was my intention that
global/findstr would contain the PREVIOUS searchstring. Please see the
attached app Any ideas? TIA With kind regards, Arie van Wingerden 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.