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

[REBOL] Re: Rebol view fields are caching entries - HELP

From: lmecir:mbox:vol:cz at: 12-Nov-2006 23:50

Yvan napsal(a):
> Hello together, > > I think I'm turning in circles. > > I want to open a layout with a field where I can enter a filename and a > button 'Edit' to open the file with the filename I entered and allowing m > e > to edit it. > > The editing stuff works more or less, but I have a very strange problem. > > To explain it I created to very crude functions with just enough code to > show you the problem. > > The functions: > > select-file: > > a layout with a field where I can enter the filename. A default value of > none is used. > > A button 'EDIT' which by pressing it would call a function 'edit-file' wi > th > the filename I entered or doing nothing if the default value of none is > still in it. > > A button 'CANCEL' which just quits the function > > edit-file: > > Would do the editing stuff, but as this is not the problem I just entered > > dummy code, > > Okay, what is the problem. > > -Start "select-file" for the first time > > -> a view opens with a filename in the field of "none" as expected. > > -Now enter dada as filename and press EDIT > > -> works as expected > > -Now, start "select-file" a second time > > -> a view opens with a filename in the field of 'dada' instead of 'none' > ,and this is very disturbing, unexpected stuff. > > I tried many things, clearing strings, enabling trace, jumping out of the > > window, but I am not able to find the reason of this problem. > > what I want is that every time I start this function the default value of > > 'none appears in the field. > > Who can help me please. > > Cheers Yvan > > PS: > > The code: > > file 'createfile.r' > > REBOL [title: "Creates File"] > > select-file: func > ["enter name manually and then edit"] > [ > view layout > > [ > text "filename" > filename: field "none" > button "Edit" > > [ > if/else NOT (filename/text = "none") > [ > unview > edit-file filename/text > ] > [ > view layout > > [ > text "No filename selected" > button "OK" [unview] > ] > ] > ] > button "CANCEL" [unview] > ] > ] > > edit-file: func > [ > filen > ] > [ > print "Will do some editing stuff" > ] > > > Mit freundlichen Gr=FCssen > Yvan >
I suppose this may be what you want: REBOL [title: "Creates File"] select-file: func [ "enter name manually and then edit" /local no-filename ] [ no-filename: copy "none" view layout blk: [ text "filename" filename: field no-filename button "Edit" [ either filename/text <> "none" [ unview edit-file filename/text ] [ view layout [ text "No filename selected" button "OK" [unview] ] ] ] button "CANCEL" [unview] ] ] edit-file: func [ filen ] [ print "Will do some editing stuff" ]