OpenButton in FileDialog

Started by Fred Tomke, March 09, 2009, 07:24:36 AM

Previous topic - Next topic

Fred Tomke

Hello, I've attached a sample.


  • copy all the files into a folder which is included in the AutoCAD supportpath
  • save the current drawing into the same folder
  • load the lisp
  • call the command opensample
  • the resizable file dialog appears
  • select one of the .81 files, properties are displayed in the listview below and the first 20 lines of the textfile are shown in the textbox (maybe you have to change the codepage to see all the chars correctly.
  • once one of the .d81 files is selected, press Open. Nothing is happen at my workstation.
  • DoubleClick the .81 file instead, the form will be closed and the filename ist given back, but why not when clicking on the open button?

I have a similar filedialog in the same project, but for writing. In that dialog the form closes when I click on save, but why not in the form to open a d81 file? Does anybody have any idea, what am I doing wrong?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

The function c:lvman_sc_gaeb_import_OnCancelClose must return NIL if you want the dialog to close.

Fred Tomke

Thank you, Owen. Normally, I should have known this.

On the other hand it discovers an other problem:

When I press ENTER when the text box with the number of lines has the focus, OnCancelClose will be fired and this argument ESCWasPressed = 0. In this case I want to prevent the form from closing. When I select a file and I press the open button, OnCancelClose will be fired and ESCWasPressed = 0. But in this case I want the form to get closed. How can I make a difference? Ok, you'll say: Trigger OnReturnPressed of the textbox. I've done it and it works: ESC closes the form, Open button closes the form, Enter in textboxe does not close the form. But do I hit Enter when the ListView currently has the focus, the form will be closed. Although I have activated the OnReturnPressed event for ListView, this event won't be fired (see new attachment). Which conditions have to be true that the ListView fires the activated OnReturnPressed event?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

I think there are still a lot of issues with the List View control. In this case, I found that the control was set to send all keyboard messages to the dialog manager instead of processing them itself. I've uploaded changed the code so that the keyboard input goes to the list view control; please test this and check for any unexpected side effects.

Fred Tomke

Hi, Owen, thank you, I will do as soon as the kids are in bed.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Hello Owen, I had a quick test, luckily pressing ENTER in the ListView does not cause any longer closing the form (and OnCancelClose is not being fired) any longer. Very nice. I had short tests with selctions and drag&drop and it still seems to work. My short test cannot replace long time tests, but I'm full of hope that it might be resolved  :) Great thanks!

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Good to hear. I've since enhanced it slightly so that the new behavior is activated only when there are events defined for either KeyUp, KeyDown, or ReturnPressed.

Fred Tomke

Ah, good to know - I was just going to deactivate the OnReturnPressed event at the listview. It should be documented? I don't know whether there will be some additional changes in future.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd


Fred Tomke

Should this behavior be transmitted to the textbox to make it uniformly?
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Yes, good idea, I will do that.