How can we remove the 'move to trash' button

Well this is not a javascript error but we can say that the error generated from frontend part of App Inventor which is written in Google Web Toolkit.

Actually a Google Web Toolkit is a java package which converts java code into a javascript which can be run in browser's window.

1 Like

@Faraz_Firoz I think you want to remove a button form UI which name is "move to trash", so what I am suggesting you why not use css for this...

Let me explain create new class in ya.css file

.my-class {
   display : none !important
}

In the code part add css class into widget I mean button component.

For adding CSS class into get button you can follow the documentation of GWT.

Ummmm..
We can also write js code inside the java code file by using JSNI (javascript native interface). there are some sources file with native methods(JSNI) in app inventor.

2 Likes

Wow, why I do not think like this
Can you please tell me style name of move to trash or from where we can get

1 Like

We should add a style name for it in the TopToolbar.java (I exactly don't know how to)
And make a class for it in Ya.css
And the code will be in (ya.css):

.class {
   display : none !important;
}

It's a Java exception: JavaScriptException (GWT Javadoc) (gwtproject.org)
It's a problem with JSNI (as @preetvadaliya has mentioned)

2 Likes

I want to know how can I add style name of MoveToTrash or from where I can get

1 Like

I mean you should add a new style name in the java file of TopToolbar.java because by default it is connected with gwt-button style name so if you add that code CSS code I said directly in the gwt-button class then every button will be invisible
but I exactly don't know how to add a style name in the java file

I want to know how to add style name

^^^
Anyways, if you want to implement CSS in Java, use JavaFX.

2 Likes

Can you please explain how can we add css in java

Please click the link, all of the details are mentioned there.

1 Like

http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/UIObject.html#addStyleName-java.lang.String-

See this documentation and this method was inherited by Button Class of GWT.

First of all you need to create a simple CSS class as I mentioned in earlier post in ya.css file because ya.css file is load in browser at the runtime now simple you need to call this method in java code so because of style rule the button was created but not show in browser window and it will not couse any error.

Yey I have removed move to trash button by this method

setButtonVisible(WIDGET_NAME_DELETE,false);

2 Likes

Yaa, this also can be one the solutions

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.