Recent

Author Topic: savedialog sometimes works and sometimes not  (Read 10019 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: savedialog sometimes works and sometimes not
« Reply #15 on: October 03, 2015, 09:40:49 pm »
I think i am on to something.

When i open excel and start "save" and then past the path in de excel save dialog box. I am not alowed to past the path in the dialogbox.

In my own savedialog i do the same. is this someting where it could go wrong??

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: savedialog sometimes works and sometimes not
« Reply #16 on: October 03, 2015, 09:48:37 pm »
Please prepare a little demo which shows the error and which you upload here. Otherwise it is just wild guessing.

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: savedialog sometimes works and sometimes not
« Reply #17 on: October 03, 2015, 10:46:58 pm »
Here is a small demo. I juist made it. I ran it 3 times and everything was ok. I waited a minute or 2 and dan tried again and it crashes.

It crashes on a pc where i am not alowed to past a path in the explorer or a save dialog from MS Office.

On my pc it runs good. On my pc i can past a path in the explorer or a save dialog from MS Office.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: savedialog sometimes works and sometimes not
« Reply #18 on: October 03, 2015, 11:37:05 pm »
It crashes on a pc where i am not alowed to past a path in the explorer or a save dialog from MS Office.

Sorry, I don't understand this. What do you mean? I never heard that it is forbidden to paste a path into a savedialog.

The demo is running fine here, and your code looks ok (except for the misplaced "try" which I would prefer immediately after the creation of the savedialog, but this should not create a crash)...

Which Windows are you using?

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: savedialog sometimes works and sometimes not
« Reply #19 on: October 03, 2015, 11:43:30 pm »
Can you run the program in the debugger (gdb) and get a backtrace?

Bart

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: savedialog sometimes works and sometimes not
« Reply #20 on: October 04, 2015, 12:00:07 am »
I am using windows 7.
on windows 7 pc's it is not always allowed to paste a path in the explorer or a save dialog of a programm. You can paste the path in the filename part of a save dialog.

windows 7 keeps track of the path youre program last used. So i wil try tomorrow what happens if i do not set the savedialog.initialdir.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: savedialog sometimes works and sometimes not
« Reply #21 on: October 04, 2015, 12:13:57 am »
I am using windows 7.
Me too.

Quote
on windows 7 pc's it is not always allowed to paste a path in the explorer or a save dialog of a programm. You can paste the path in the filename part of a save dialog.
What are you doing when you "paste a path in the explorer or a save dialog of a programm"? If I open the explorer, SHIFT-right click on a file, select "Copy as path" (or similar) to copy the entire path to the clipboard, open Lazarus, "File" / "Open", then I can paste the copied path into the FileDialog. Why shouldn't this be possible?

rvk

  • Hero Member
  • *****
  • Posts: 6163
Re: savedialog sometimes works and sometimes not
« Reply #22 on: October 04, 2015, 12:52:42 am »
Why shouldn't this be possible?
i.e. Could you find out what policies were implemented to restrict this behavior.

If we can test with these same restrictions maybe we can find the problem more easily.

Also... is the address bar in explorer just not visible or is it visible and can't you paste anything there?
« Last Edit: October 04, 2015, 12:56:39 am by rvk »

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: savedialog sometimes works and sometimes not
« Reply #23 on: October 04, 2015, 08:34:56 am »
The addressbar is visible. You just cant paste to it. I have to ask what policies are implemented.

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: savedialog sometimes works and sometimes not
« Reply #24 on: October 09, 2015, 08:43:07 pm »
I do not the name of the policie but it is a windows policie which is often used together with Citrix. At least that is wat i am being told.
I prevents the user from paste a path into a adresbar of the explorer or a dialogbox.

I stopped filling the initial dir from the save dialogbox and that seems to help. The savedialogbox worked correct this week. I tested it a few times in to 2 Citrix enviroments

rvk

  • Hero Member
  • *****
  • Posts: 6163
Re: savedialog sometimes works and sometimes not
« Reply #25 on: October 10, 2015, 01:57:48 am »
Ok, I might have found the restiction setting.
Do you get a message "Accessing the resource xx has been disabled" when you try to enter something in the addressbar? (like attached image)

If so, then this is the setting which is done:
start gpedit.msc > User Configuration > Administrative Templates > Start Menu and Taskbar > Remove Run menu from Start Menu
Set this setting to enabled

It's not possible anymore to type something in the address-bar (you'll get the error as in the attached image). But it's still possible to change directory via the filename-part. In that case this setting looks useless but actually the address-bar is also used to execute programs (run) and that's made impossible with this setting.

This simple example, though, didn't crash for me when this restriction was in place:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.  Save: TSaveDialog;
  4. begin
  5.   Save := TSaveDialog.Create(nil);
  6.   try
  7.     Save.InitialDir := 'D:\TEMP\';
  8.     if Save.Execute then Showmessage(Save.Filename);
  9.   finally
  10.     Save.Free;
  11.   end;
  12. end;

Also... your Test_savedialog.exe works correctly with this setting in place. Could you try setting this restriction on your computer and look if it also has problem for you locally? If it doesn't then the problem must be something else (related to Citrix).
« Last Edit: October 10, 2015, 02:02:51 am by rvk »

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: savedialog sometimes works and sometimes not
« Reply #26 on: October 17, 2015, 11:51:51 am »
There is no error. You just cant paste into it. There are also no local drives so d: is no option. Since i stopped useing inialdir everythingvworks fine.

rvk

  • Hero Member
  • *****
  • Posts: 6163
Re: savedialog sometimes works and sometimes not
« Reply #27 on: October 18, 2015, 11:08:53 am »
There is no error. You just cant paste into it. There are also no local drives so d: is no option. Since i stopped useing inialdir everythingvworks fine.
That's why I suggested you create the restriction yourself on your local development machine. That way you can make sure, if it also crashes on that one, that this is the problem. If it doesn't crash on your machine then the restriction is not the problem. You could go on not using the initialdir but then you/we will never know what the real problem was.

But ok, if this is not the restriction that's used it doesn't matter. The same restriction needs to be applied.
« Last Edit: October 18, 2015, 11:11:42 am by rvk »

 

TinyPortal © 2005-2018