Can't make my button clickable

Users who are viewing this thread

guiskj

Knight
I got a button in a new prefab but I must be missing something because it won't click nor call the click function.

Here is the prefab

XML:
<?xml version="1.0" encoding="utf-8" ?>
<Prefab>
  <Constants />
  <VisualDefinitions>
  </VisualDefinitions>
  <Window>
    <Widget WidthSizePolicy="StretchToParent" HeightSizePolicy="StretchToParent">
      <Children>

        <ButtonWidget  WidthSizePolicy="Fixed" HeightSizePolicy="Fixed" SuggestedWidth="60" SuggestedHeight="40" HorizontalAlignment="Right" VerticalAlignment="Center" Brush="FaceGen.Extension.Button" Command.Click="TestFunction" MarginRight="650" MarginTop="500">
          <Children>
            <ImageWidget DoNotAcceptEvents="true" WidthSizePolicy="Fixed" HeightSizePolicy="Fixed" HorizontalAlignment="Center" VerticalAlignment="Center" SuggestedWidth="34" SuggestedHeight="25" Brush="FaceGen.Extension.Clothe.Button" />
            <HintWidget DataSource="{PresetHint}" WidthSizePolicy="StretchToParent" HeightSizePolicy="StretchToParent" Command.HoverBegin="ExecuteBeginHint" Command.HoverEnd="ExecuteEndHint" />
          </Children>
        </ButtonWidget>

      </Children>
    </Widget>
  </Window>
</Prefab>

And my ViewModel class
C#:
    class CharacterGenPresetViewModel : ViewModel
    {
        public void TestFunction()
        {
            Utils.Logger.Log("TestFunction");
        }

        public void ExecuteBeginHint()
        {
            Utils.Logger.Log("ExecuteBeginHint");
        }

        public override void RefreshValues()
        {
            base.RefreshValues();

            Utils.Logger.Log("RefreshValues");
        }
    }
 
I have finally figured this out.

The Layer object needs to call this:
C#:
_layer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.MouseButtons);

This makes the button widget interactive but causes input events to not flow to "lower" layers making other stuff not clickable...
 
Upvote 0
Back
Top Bottom