ask file with type

Deploying to Linux? Get penguinated here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
HelmutMueller
Posts: 17
Joined: Tue May 20, 2008 12:21 pm

ask file with type

Post by HelmutMueller » Thu Nov 06, 2008 4:27 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3999
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Thu Nov 06, 2008 5:47 pm

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

HelmutMueller
Posts: 17
Joined: Tue May 20, 2008 12:21 pm

Post by HelmutMueller » Sat Nov 08, 2008 4:55 pm

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

HelmutMueller
Posts: 17
Joined: Tue May 20, 2008 12:21 pm

Post by HelmutMueller » Sat Nov 08, 2008 5:03 pm

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

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Sat Nov 08, 2008 5:39 pm

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
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

HelmutMueller
Posts: 17
Joined: Tue May 20, 2008 12:21 pm

Post by HelmutMueller » Sat Nov 08, 2008 5:52 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3999
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Sat Nov 08, 2008 6:58 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Nov 08, 2008 8:53 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

HelmutMueller
Posts: 17
Joined: Tue May 20, 2008 12:21 pm

Post by HelmutMueller » Mon Nov 10, 2008 9:36 am

@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 :-)

Post Reply

Return to “Linux”