Page 1 of 2
					
				Focus not returning after dragdrop
				Posted: Sat Oct 31, 2015 9:24 am
				by skindoc4
				Has anyone else noticed this odd behaviour.
After performing a dragdrop of an image, the screen becomes unresponsive to the mouse. Responsiveness is only restored by clicking the titlebar or another window and then returning to the window where the dragdrop occurred. It is a great nuisance.
The following is in the image's handler.
on dragEnter
      set the dragAction to "copy"
end dragEnter
command dragdrop
   doDragDrop the long id of me
end dragdrop
-- this code is held elsewhere
command doDragEnter
      set the dragAction to "copy"
end doDragEnter
command doDragDrop theImage
   put the dragData["files"] into theFile
   put url ("binfile:" & theFile) into theImageData
   
   mPlaceImage theImage,theImageData
   
end doDragDrop
command mPlaceImage thePlaceHolder,theImageData
   lock screen
   put the width of thePlaceHolder into thePDim
   put the left of thePlaceHolder into theLeft
   put the top of thePlaceHolder into theTop
   
   set the text of thePlaceHolder to theImageData
   put the width of thePlaceHolder into theImageWidth
   put the height of thePlaceHolder into theImageHeight
   
   if theImageWidth > theImageHeight then
      put thePDim into theNewWidth
      put theImageHeight * thePDim/theImageWidth into theNewHeight
   else
      put thePDim into theNewHeight
      put theImageWidth * thePDim/theImageHeight into theNewWidth
   end if
   
   set the width of thePlaceHolder to theNewWidth
   set the height of thePlaceHolder to theNewHeight
   set the left of thePlaceHolder to theLeft
   set the top of thePlaceHolder to theTop
   unlock screen
end mPlaceImage
Using Livecode 7.1.1 rc2 on a MacAir with El Capitan
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Sat Oct 31, 2015 2:54 pm
				by Klaus
				Hi skindoc4,
I think this is correct behaviour!
Other apps also show this, e.g. drag and drop anything from the FInder to an open TextEdti document.
TextEdit will not come into foreground after dropping something onto it, all this happens in the background.
Maybe you can add an AppleScript which will bring your app into the foregound again dorectly after dropping?
Best
Klaus
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Sat Oct 31, 2015 2:58 pm
				by skindoc4
				Hi Klaus
I see it now. Thanks. Applescript sounds like an option. I shall have play.
Cheers
Alex
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Sun Nov 01, 2015 2:35 am
				by skindoc4
				Nothing I have tried so far works. I have to manually click the titlebar to get anything on my sheeted substack to work. Applescript doesn't do it - at least that which I have tried so far. The window just remains hung until I click in the titlebar or in the finder or somewhere other than where I want to click, namely in the window where I have just dragged an image.
I have another problem. The buttons which switch on tools (brush, pencil) do not work in either sheet or modal mode but only in editable window mode??
When I add an image to a patient's notes, I want this to be in a modal modal mode so that when I close the image inserting stack, I return to the text field in the patient's notes. So this gotcha is in the way at the moment.
Any advice gratefully received.
Cheers
Alex
community LC 7.1.1 rc2  on El Capitan
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Sun Nov 01, 2015 4:55 pm
				by Klaus
				Hi Alex,
skindoc4 wrote:The buttons which switch on tools (brush, pencil) do not work in either sheet or modal mode but only in editable window mode?
This is exspected and correct behaviour, modal stacks, and sheets are modal "the Mac way", are not editable!
If in development mode you need to open all your stack you want to work on in TOPLEVEL mode!
Best
Klaus
 
			
					
				Re: Focus not returning after dragdrop
				Posted: Sun Nov 01, 2015 11:15 pm
				by skindoc4
				Thanks Klaus
I shall tell you what I want to do. Say I want to describe the distribution of a person's back pain. I want to be able to import a generic outline image of the human body and mark the areas where the patient reports pain, and then move the image into the patient's notes. All this I can do when the stack is the top stack but not as you say when the stack is modal or sheet. The advantage of using modal or sheet is that the stack I am working on stays at the toplevel until I am finished with it which is a much neater solution than having stray windows floating on the desktop.
I found the section in the User Guide which explains all this and yes you are right - only the browse tool is available in other than editable windows. I have an idea which will make it work in a neat fashion. Thanks for your guidance.
Cheers
Alex
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Mon Nov 02, 2015 1:31 pm
				by Klaus
				Hi Alex,
just to be sure: YOU are using the LC IDE, but your customers will probably not! (Will they?)
So your users can only do what you let them do via your scripting.
And you can script to let the user do all this even in a modal window, but it's up to you! 
 
 
Best
Klaus
 
			
					
				Re: Focus not returning after dragdrop
				Posted: Mon Nov 02, 2015 10:03 pm
				by skindoc4
				Hi Klaus
I am the only customer since I long ago decided that I preferred being a clinician than a full time supporter of software that I write. I did enough of that when I ran a medical practice with software I wrote in 4D some years ago. But yes I do use a standalone version when I am seeing patients.
So far I have found the same issues in the IDE as in the standalone so I do not quite know what you mean about being able to script the use of the brush and pencil tools in modal/screen/palette windows as I have not found a way.
Cheers
Alex
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Mon Nov 02, 2015 11:11 pm
				by Klaus
				Hi Alex,
skindoc4 wrote:...So far I have found the same issues in the IDE as in the standalone so I do not quite know what you mean about being able to script the use of the brush and pencil tools in modal/screen/palette windows as I have not found a way.
it IS possible somehow, that's for sure, but probably not worth the enormous efforts, at least I would not want to do it 
 
 
Best
Klaus
 
			
					
				Re: Focus not returning after dragdrop
				Posted: Mon Nov 02, 2015 11:59 pm
				by skindoc4
				Yes Klaus
Desktop real estate is at a premium on my MacAir which I use in my clinical work so I am pursuing alternative ways of achieving my outcome.
Thanks for all your advice.
Cheers
Alex
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Tue Nov 03, 2015 2:47 am
				by bn
				Hi Alex,
I thought I give it a try what I understood you wanted to do and made a demo stack that opens a substack as sheet on MacOSX. The substack has an image that you can draw with graphics on, once you are done you can export the image (currently to the main stack)
The stack I used is a slight modifications of 
http://livecodeshare.runrev.com/stack/3 ... on-Graphic
an old stack I made.
you can choose the color of the graphic, the line size, transparency of the graphic you use to annotate the image. Use button "topLevel" to get out of sheet mode. Use button "exportToMain" to export an image to the main stack. Use button "setModelImage" to set different images. (currently only one image is stored as custom property of the substack, so the button is actually "useless" but shows how to have different images to annotate).
You can option-click on a graphic to select the graphic and move it with the arrowKeys. Opaque closes the polygon and the background color will be visible (probably not so useful in your case.
I tested in LC 7.1.1 rc1, the stack is in LC 5.5 format. It is a long time since I used sheet, but Livecode is still a bit finicky with sheet, sometimes it took the properties inspector to show the sheet. If that happens close the properties inspector. 
You would probably have to adapt the substack to your needs but basically I think it lets you annotate an image.
Kind regards
Bernd
 
			
					
				Re: Focus not returning after dragdrop
				Posted: Tue Nov 03, 2015 3:00 am
				by skindoc4
				Hi Bernd
Thanks so much for this. I shall have a play.
Cheers
Alex
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Wed Nov 04, 2015 6:41 pm
				by bn
				Hi Alex,
did you see that I attached a stack to the previous message?
Kind regards
Bernd
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Wed Nov 04, 2015 10:33 pm
				by skindoc4
				Actually Bernd I had not seen it - thank you.
Alex
			 
			
					
				Re: Focus not returning after dragdrop
				Posted: Wed Nov 04, 2015 11:09 pm
				by skindoc4
				Neat. There are clearly a few parts of the language that I need to learn.
Cheers
Alex