Page 1 of 1
ask file with type
Posted: Thu Nov 06, 2008 4:27 pm
by HelmutMueller
Hi all,
I have a strange behaviour when calling the ask file dialog:
I assume this code should open the window, show the files in the dir "/home/hm/ and propose the filename "Untiteled.txt" as default in the file field :
Code: Select all
ask file "Save to:" with "/home/hm/Untitled.txt"
but:
The filename field remains empty, the path is correct.
The dialog seems to be the one provided by the system (KDE4). The Dictionary states that under Linux always the revolution provided dialog will be used. This seems to be wrong!
So i tried to
Code: Select all
set the systemFileSelector to false
and indeed i get an other dialog, it seems to be the one from revolution (as I have never seen it before), but
this dialog always shows the Directory that was selected the last time and offers the filename with the whole path in the file field. So it doesn't change to the correct directory and puts to much into the filename field.
So with both ways I'm not able to get the correct behaviour...
Any ideas ?
Thanks in advance,
Helmut Müller
Posted: Thu Nov 06, 2008 5:47 pm
by bn
Hi Helmut,
try this and look if it works, it works for me for rev 3 Mac OS X 10.5.5 to make shure everything is allright with your path etc.
Code: Select all
on mouseUp pMouseBtnNo
answer folder "please choose folder"
if it is empty then exit mouseUp
put it into tFolderPath
put tFolderPath & "/" & "Untitled 1.txt" into tWholePath
ask file "please choose file" with tWholePath
put it
end mouseUp
other than that I have no idea, sorry
regards
Bernd
Posted: Sat Nov 08, 2008 4:55 pm
by HelmutMueller
Thanks Bernd,
I'll give it a try next week when i`m back at my Linux Box.
But I think it should work with the shown scripts as pathes in linux are easier and quite simple under linux. With MacOS it looks quite different as there are language specific translations of parts of the path. But I'll see.
Helmut
Posted: Sat Nov 08, 2008 5:03 pm
by HelmutMueller
It seems that the revolution provided dialog is generaly not able to switch to the right directory and to provide only the filename without the path in the correct field: I just tried it under MacOS and it showed the same behaviour as described above!
So it seems that at least the revolution provided ask dialog doesn't behave as written in the documentation. Could anybody from runrev confirm that to prevent me and others from trying to fix our code to make sure it behaves as assumed after reading the docs ?
Helmut
Posted: Sat Nov 08, 2008 5:39 pm
by BvG
I can't reproduce your findings. The following code works as expected from Rev 3.0 under Mac OS X 10.5.5 (note that if you want to test this particular code, the stack you'll execute it from needs to be saved to the hard drive for the path generation to work):
Code: Select all
on mouseUp
put the effective filename of this stack into thePath
set the itemdelimiter to slash
put item 1 to -2 of thePath into thePath
ask file "some file" with (thePath & "/somefile.txt")
end mouseUp
Posted: Sat Nov 08, 2008 5:52 pm
by HelmutMueller
Yes, under MacOS the System provided Ask Dialog works as expected.
But could you try the revolution provede one ( via set the systemFileSelector to false to ask revolution to use it own )?
At least for me this doesn't work as expected ( see above)
CU
Helmut
Posted: Sat Nov 08, 2008 6:58 pm
by bn
Helmut,
if I set the systemFileSelector to false I get the behaviour on my Mac that you describe under Linux.
If I modify the code to
Code: Select all
on mouseUp
set the systemfileselector to false
put "untitledWithoutPath.txt" into tFilename
put the defaultfolder into tOldDefault
set the defaultfolder to "path/To/Other/Folder"
ask file "please choose file name" with tFilename
put it into tWholePath
put "anything" into temp
open file tWholePath
write temp to file tWholePath
close file tWholePath
set the defaultfolder to tOldDefault
put it
end mouseUp
then it works more like expected, i.e. in the filename box you just see the filename, which you can change and use as a valid whole path to save your file. And it defaults to the predefined directory. This, again, is on MacOS X 10.5.5 etc. Even if I was of no help I at least got to know the systemFileSelector property

Maybe some Linux expert has some insight to share.
regards
Bernd
Posted: Sat Nov 08, 2008 8:53 pm
by Mark
Hi,
I'm posting this from a Linux virtual machine. I tried the following:
Code: Select all
on mouseUp
set the systemfileselector to false
put "Untitled.txt" into tFilename
put the defaultfolder into tOldDefault
set the defaultfolder to "~/documents"
ask file "please choose file name" with tFilename
put it
end mouseUp
Rev's built-in file selector shows up with the path to the Revolution engine, rather than the default folder. Apparently, this doesn't work.
I have also tried using Linux' file dialog, which doesn't work either.
Seems like a bug to me.
Best,
Mark
Posted: Mon Nov 10, 2008 9:36 am
by HelmutMueller
@Bernd:
I tried your first solution code and as I expected there is the same odd behaviour that I described: the filename field is not filled with the suggested filename.
Only if a file with this name exists in the folder, the field is filled with this name.
Strange ...
I didn't try the other code snipplets as I don't want to work around, I just wanted to mention the bug under linux.
Helmut
BTW: not so many linux developer around, many more MacOS user ( and of course Windows). I can't remember any other forum ( Mac forums excluded) where more Macies are active then Tuxe
