I have created various imageIcons on a JPanel and can drag and drop them onto each other. But I want to disable the ability of some of them from accepting drag and drop. IE I don't want some of them to be changed .They have been set up using JLabel label = new Jlabel(icon) etc
Any help will be appreciated.
It's ok I worked it out. I reset the TransferHandler with a null poperty : mylabel.setTransferHandler(new TransferHandler(null));
Related
When I drag Class element onto my diagram there is a window fired "Paste Class1", where I can choose the drop type, such as "Link","Property","Instance (Object)" and so.
I need to change that behavior - when I drag from ProjectBrowser I need apply only drop type "Link" and hide any variants from end user. Is it possible to do that via addin or anything else ?
Sparx 13.5
No you can't change the behavior of that dialog.
What you can do in an add-in is overrule whatever the user chose after the fact, and make it into a link anyway. (e.g. deleting the instance from the model and set the elementID of the classifier in the DiagramObject instead)
There is also a checkbox option to only show this window when Ctrl-drag is used. That might help to avoid mishaps as well.
in an empty game object i have a selection Manger script. I'm having some difficulties with finding a panel (called: OpenSelection) I created in Canvas.
I would like to find the panel where ever it is in the hierarchy and set enabled to true.
But the code isn't finding the panel. I'm not sure why.
any help would be appreciated
//UI
private GameObject panel;
// Start is called before the first frame update
void Start()
{
panel = GameObject.Find("OpenSelection");
panel.SetActive(true);
}
Generally, Find() is never the best approach for anything.
Try to set a variable reference to your OpenSelection, like you did with your panel, then call this variable.
GameObject.Find() only returns active GameObject. Here you are trying to find the OpenSelection panel which is not active. That's why the Find() is not finding the OpenSelection panel.
I want to access button properties such as .interactable = false; of a button which is inside a GameObject. I want to access the button via GameObject. I tried below method but i could only access few properties like .SetActive.
gameObjectA.transform.GetChild(0).gameObject.SetActive(false);
where gameObjectA is my GameObject and GetChild(0) is my Button
I want to access other properties such as .Color, .Interactable etc.
Please Help. Thanks in Advance
Try using GetComponentInChildren, this will return the first instance of a button found in the gameobject or one of its children (recursive)
Button childbutton = GetComponentInChildren<Button>();
childbutton.interactable = false;
If you have several children with buttons you can the gameObject.transform.GetChild() that you were already using with a normal GetComponent(replace x with the child index)
Button childbutton = gameObjectA.transform.GetChild(x).GetComponent<Button>();
You can also assign and read tags or names if you are changing and adding buttons constanly and dont want to rechange your code
private ImgButton button = new ImgButton();
...
button.setSrc("iconName.jpg");
GWT or SmartGWT, I cannot tell exactly, generate state word to concatene it on the name of file.
Example to clarify :
On focus, iconName.jpg become iconName_Focus.jpg
On mouse down click, iconName.jpg become iconName_Down.jpg
On over, iconName.jpg become iconName_Over.jpg
Because these images are custom images, I want to tell GWT to take a default image when I didn't provide the corresponding image.
For example, when over event is fire and iconName_Over.jpg does not exist then use iconName.jpg.
Use the setShow{State} or setShow{State}Icon methods accordingly. For example for disabling the mouse down state, use setShowDown(Boolean.FALSE). For not showing a different icon when the mouse goes down on the button, use the setShowDownIcon(Boolean.FALSE). The rest of the actions have accordingly named methods you can look up at the ImgButton's javadoc page.
How do you go about cancelling a drop event using the latest Silverlight Toolkit Drag and Drop framework? I'd assume this has to be stupid, but I don't seem to be able to find any valid information to get me to the right place.
Any guidance would be helpful.
Within the drag operation you can set:
e.Handled = True
e.cancel = True
You can set these on drag over as well. But you can also do a similar thing within the drop operation.
AllowDrop="False"
Do nothing in drop handler