Skip to content

Drag and Drop Button #319

Answered by JaggerJo
matthewcrews asked this question in Q&A
Jun 22, 2023 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Hey @matthewcrews 👋

Top, Left, Right, Top are attached properties of the canvas. You need to wrap the button control in a canvas for them to have any effect.

    let view (state: State) (dispatch) =
        Canvas.create [
            Canvas.children [
                Button.create [
                    Button.top state.Y
                    Button.left state.X
                    Button.width 10.0
                    Button.height 10.0
                    Button.background "Blue"
                    Button.onPointerPressed (fun _ ->
                        Msg.Selected |> dispatch)
                    Button.onPointerReleased (fun _ ->
                        Msg.Deselected |> dispatch)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@matthewcrews
Comment options

@JaggerJo
Comment options

@matthewcrews
Comment options

@Happypig375
Comment options

Answer selected by matthewcrews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants