I am building a LiveCode stack and want to add drag drop into my app. In particular, I would like to be able to click on one image and drag it to a second location.
I would also like to provide feedback to the user that they are in fact dragging. A thumbnail would be ideal.
I know how to change the cursor when I hover over my image:
on mouseEnter
lock cursor
set the cursor to "hand"
end mouseEnter
on mouseLeave
unlock cursor
end mouseLeave
Dragging within LiveCode is accomplished by the various drag messages that are available. An example of this if you have two images on your stack would be-
Script of image 1
on dragStart
set the dragData["text"] to the text of image 1
set the dragImage to the id of me
end dragStart
Script of Image 2
on dragEnter
set the dragaction to "copy"
end dragEnter
on dragDrop
set the text of the target to the dragData["text"]
end dragDrop
When image 1 is clicked and dragged, its text (contents) are placed into the dragData array, its dragAction is set to copy and the drag image is set to the image id of itself. THis is the transparent image that indicates what you are dragging.
In image 2, when a user is dragging and enters the image, it sets the acceptDrop to true and when the user releases the mouse (dragDrop) the text of the image is set the to the dragData["text"] array
While the drag and drop suite of commands and messages is rich and powerful, if all you need to do is move something from one location to another inside of your application window, don't overlook the simple grab command. It allows you to click down on an object and have the object follow your mouse pointer until you release the mouse button. For example, the following script in the object to be dragged works well.
on mouseDown
grab me
end mouseDown
on mouseUp
# do whatever evaluation you need to do here
# e.g., check to see whether the drop location is a valid target area
# Here is one way to do it:
if the location of the target is within the rect of graphic "hotspot" then
put "That's right!" into fld "feedback"
end if
# If you are dragging to an irregular target area do this instead:
if within(graphic "irregularPoly",the loc of the target) then
put "That's right!" into fld "feedback"
end if
end mouseUp
Related
The default way to select a group of objects interactively in fabricjs is to drag, which displays a blue selection rectangle and then, when the mouse is released, selects all the objects in the rectangle.
Because I am using the drag action to pan the background canvas, I want to change the way to select to use only Control + drag, i.e. hold down the control key while dragging. In all other respects, the behaviour should be the same as the default. Is this possible? How?
The reason for wanting to use Control + drag is that it then matches what the user needs to do in another part of the app I'm building.
I have a user form, there are several frames inside each of them, there are many text boxes, I want to fill the information from top to bottom, but the cursor moves randomly (vertical and horizental)between the text boxes.
How can i enter data verticly from top to bottom and at end it should go to next coulmn?
You need to configure the TabIndex property of each one of the controls, so that at each enter stroke or tab stroke the next control is the one that has the next TabIndex value.
Here https://learn.microsoft.com/en-us/office/vba/language/concepts/forms/set-the-tab-order-using-the-tabindex-property you can find more on this.
I'm wondering if you guys have an idea on how to handle this problem.
Process:
First i iterate trough this collection. If the input value is the same as the item of the grid box it will stop and select this item.
View of SAP GridBox
Note that every spy mode will select EVERYTHING and the only way to actually read this is with SAP GrixBox.
The problem here is that i need to click the small grey square on the left of the selected Notification. I cannot select it with any hotkey or with a spy mode.
Small grey square MANUALLY selected
My idea was to use capture an highlighted item with the Region mode and then move 5px to the left. But this does not seem to work ...
Any suggestion are welcome!
If I recall correctly the shortcut for selecting an entire row in Sap Grid is Shift + Space. You need to have a cell selected first, though.
I have a search box where I can enter the search text however there is no search button next to it. So we use to press enter button after enter the search text in text box.
Please advise how to handle this in blue prism. I have tried using Global Send Keys however the focus moved out of the search box hence nothing happening
If the mouse focus is inside the text box then you can see a 'X' mark inside it
If I use the global sendkeys then the mouse focus is outside the text box as below
To go about this issue, I would first try to set the focus on the field, by sending a Global Mouse Click Center (not just focus) to the Textbox.
Next, send the "{ENTER}" or "~" key to the Textbox, using Send Global Keys.
I would assume that if that doesn't work, you have spied the container of the Textbox, not the Textbox itself somehow.
Alternatively, as a last resort you can also choose to send a Javascript command to the webpage, in order to trigger the form submission. This can be achieved by using the Navigate stage on the Application Model's top element (highest in hierarchy).
Good luck!
I have a scrolled window in my application, in which I have created a drawing area widget. In the drawing area, I have placed multiple images. When the user enters information about an image in a search box, the appropriate image gets highlighted.
My problem is how do I get the application to scroll automatically to the highlighted Image box without the user using the scroll bar. The scrolledwindow should automatically move the view region, to display the region where the highlighted Image is present.
The scrolling policy used on the scrolled window is XmAUTOMATIC.
Any pointers would be greatly appreciated.Thanks in advance.
Try XmScrollVisible() if this does not work then you will need to:
1. Find out the size of the work area.
2. Find out the size and position of the clip window.
3. Find out the max/ min values for the horizontal scrollbar.
4. Use XmScrollBarGetValues() for the horizontal scrollbar to get its position within the max/min values.
5. Do some math magic to determine how much to move the horizontal scrollbar to get the work area to show through the clip window.
6. Call XmScrollBarSetValues() with Notify = True.
7. Repeat for the Vertical scrollbar.
HTH