How to activate a button?

Develop a timer script, the idea of this script is that after an amount of time has passed, a button that I have in the scene is activated, this script also uses this script uses DontDestroyOnLoad, but I cannot activate it because of the following error:

“MissingReferenceException: The object of type ‘GameObject’ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. DigitalRubyShared.Timer.Update () (at Assets / DIC / Scripts / Timer.cs: 53)) “

From what I understood is that this button object is destroyed when I change scenes, so how can I keep this object?

 public static float currentTime;         public static float endTime = 0f;         public static bool startTime = false;         public static string recibir;         public static Timer estadoTimer;         public string tiempoEscena;         public string nombreEscena = "Mapa_Izquierdo";          public GameObject aceptar;         [SerializeField] Text Contador;          void Start()         {             currentTime = 0f;         }          void Awake()         {             if(estadoTimer == null)             {                 estadoTimer = this;                 DontDestroyOnLoad(gameObject);             }else if(estadoTimer != this)             {                 Destroy(gameObject);             }          }          void Update()         {              if (startTime != false)             {                 currentTime += 1 * Time.deltaTime;                 Contador.text = currentTime.ToString("0");                  if (Contador.text.Equals(tiempoEscena))                 {                     //SceneManager.LoadScene(nombreEscena);                     aceptar.SetActive(true);                     currentTime = endTime;                     stopTiempo();                 }              }             else             {                 Contador.text = currentTime.ToString("0");             }      } 

Design line breaks on hover, or button breaks

A common problem I experience is the one below.

enter image description here

  • Everything is in line in the first state.
  • On hover, the vertical line is still in place.
  • On hover, the button space is not equal on both sides which is bad.
  • If adding missing space to the left inside the button, the horizontal line will break.


Leaving it like it is will break the button on hover. Adding space to the button will break the rest of the layout.

A fix could be adding space and a visible background to fix it, but maybe a visible background is not what we want.


Is there a good way to fix this common issue?

Ubuntu 18.04 does not suspend using power button the the computer when screen is locked

I have a HTPC and it needs to be suspended with the convenience of the power button. Even when the screen lock appears on the display!After leaving the ubuntu 18.04 system idle for a while, it activates the screen lock. After doing so, the single press of the physical power button on the computer does not suspend it anymore.

On click of save button, 1 column to take the value of another column in a list

I have a list with columns “due date” and “revised date” in SharePoint.

I want to enter the due date column only when I am entering items for the first time. Onclick of save button I want the revised due date to have the value of due date. The revised due date can be editable later but for the first time it should take the value of due date.

How can I achieve this?

How to edit ribbon button tooltip

There is a custom ribbon button MyButton declared inside feature and deployed on site. Now I need to change it’s tooltip value in some cases:

  • Button enabled: Some text
  • Button disabled and there is value in web property bag: Some text
  • Button disabled and there are no value in web property bag: Other text

First, I’ve tried to get ribbon button object in JavaScript and edit it’s properties after page load. Such API wasn’t found, though. Actually, I can get button object in the way like:

var ribbonPageManager = SP.Ribbon.PageManager.get_instance(); var ribbon = ribbonPageManager.get_ribbon(); var button = ribbon.$  38_1.$  5_0 {     Id: "Ribbon.Documents.New.MyButton",     Alt: "My Button",     Command: "MyButtonAction",     LabelText: "My Button",     Image16by16: "/_layouts/15/mybutton_16.png",     Image32by32: "/_layouts/15/mybutton_32.png",     TemplateAlias: "o1",     ToolTipTitle: "My Button",     ToolTipDescription: "Some text" } 

Second, I’ve tried to create PageComponent but there are no ribbon button properties either.

Next, I’ve tried to replace CommandUIDefinition on server side after changing web property bag value. But it duplicated existing ribbon button instead of replacing. My PowerShell snippet:

$  web = Get-SPWeb http://mysite $  xml = New-Object XML; $  xml.Load("C:\CommandUIExtension.xml"); $  action = $  web.UserCustomActions.Add() $  action.Location = "CommandUI.Ribbon" $  action.RegistrationType="ContentType" $  action.RegistrationId="0x0101005FFBD71906344882B67C08F40847968B" $  action.Sequence = 10001 $  action.Title = "Replace My Button Action" $  action.CommandUIExtension = $  xml.OuterXml $  action.Update() 

Where CommandUIExtension.xml contains:

<CommandUIExtension>     <CommandUIDefinitions>         <CommandUIDefinition Location="Ribbon.Documents.New.Controls._children">             <Button Id="Ribbon.Documents.New.MyButton"                  TemplateAlias="o1"                  Command="MyButtonAction"                 LabelText="My Button"                  ToolTipTitle="My Button"                  ToolTipDescription="Other text"                 Image16by16="/_layouts/15/mybutton_16.png"                  Image32by32="/_layouts/15/mybutton_32.png" />         </CommandUIDefinition>     </CommandUIDefinitions>     <CommandUIHandlers>         <CommandUIHandler Command="MyButtonAction" CommandAction="javascript: MyButtonAction();" EnabledScript="javascript: MyButtonActionEnable();"/>     </CommandUIHandlers> </CommandUIExtension> 

The only solution now is to handle DOMSubtreeModified event and to change tooltip text on the go:

$  (document).on('DOMSubtreeModified', function(){     _tooltip = $  ("#Ribbon\.Documents\.New\");     //If tooltip exists and it wasn't modified yet     if (_tooltip.length > 0 && !"modified")) {         if (MyButtonCheck()) {   "modified", true);             _tooltip.find(".ms-cui-tooltip-description").html("Other text");         }     } }); 

Is there any solution to resolve this problem? Thank you.

Manual refresh button for SP2010 Web Part

I’m a novice SharePoint user. I have been given a task to build a manual refresh button for a web part that displays certain fields from a list. The native refresh button is not a feasible option for me as it is not available in the datasheet view and that is used most by average users. Automatic data refresh also won’t work because of network and bandwidth restrictions. I would really appreciate it if someone can point me in the right direction. Thank you.

Should a Save button be disabled if there have been no changes made?

I have a desktop application, and in this application there is a non-modal dialog where a user can make changes to something. The dialog has a Close button and a Save button. The Save button does not close the dialog, because we expect users to be making these changes, checking the result, and then possibly making more changes.

The state of the dialog will always be valid, there are no required fields or anything like that.

We have come up with two options for the save button:

  1. Leave the Save button enabled at all times. When a user clicks it, it will briefly display a check mark or perhaps a short success message for a couple seconds.
  2. Disable the Save button until a change has been made, then enable it. When clicked, it will go back to being disabled.

I can see pros and cons to each approach. Is there any accepted standard or a reason why one approach is better?