How can we remove the 'move to trash' button

Same I have done but I got error


I am getting this error

Does it load after that?

Click on "ok" and post bug message

No, It is not loading after that after that a blank page came

When I click on ok It redirect me to a new tab in which I got these things

Ooops! We tripped on a Bug!
Please help us by telling us what you were doing at the time this happend. We have already included some technical data with this report. If you do not submit this report, nothing will be reported to us. If you do submit a report, your comments along with the technical data will be sent to us.

Thank you for your help in making MIT App Inventor better!

Technical Data to be Submitted:

notes = Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36
foundIn = v185a-125-gce385622
faultData = com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read properties of undefined (reading 'element_0')
projectId = -1

this is a javascript error which says that the element does not exists element_0 so it cant read its properties

I don't know but is it really a JS error I don't think so :thinking:

Yup 100% sure

But in appinventor js is nor used much and I do not edit any js file

1 Like

:point_down:

It may be a JS error but only in the browser, because AI2 sources don't use JS much except only for the blocklyeditor folder which used for the Blockly blocks

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