MakeButton Error

Find quick help here to get you started with Hollywood
Post Reply
ocean77
Posts: 111
Joined: Mon Jan 28, 2019 8:34 pm

MakeButton Error

Post by ocean77 »

What exactly is wrong with this line? :

MakeButton(1, #SIMPLEBUTTON, 0, 0, 100, 100, {OnMouseDown = p_DialRotLeft})

Hollywood 9 says the usage/ parameters are wrong, but I can't figure out what it is.
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: MakeButton Error

Post by amyren »

I think you need to check the rest of your script
Even just adding an empty function will make it run withot errors. Perhaps your function name is misspelled or missing the ()

Code: Select all

Function p_DialRotLeft()
EndFunction
MakeButton(1, #SIMPLEBUTTON, 0, 0, 100, 100, {OnMouseDown = p_DialRotLeft})
plouf
Posts: 462
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: MakeButton Error

Post by plouf »

Ibthink it is wrong error message

Makebutton only works when a bgpic is active (so no when rapagui exist for exmple)

Also these are some restriction when used between flipbuffer() (which i dont really recall atm)
Christos
ocean77
Posts: 111
Joined: Mon Jan 28, 2019 8:34 pm

Re: MakeButton Error

Post by ocean77 »

Well this is the complete script (just something I'm testing out)
I don't know what I am doing wrong here... But it's probably obvious. :roll:

Code: Select all

@VERSION 9,0


/*
** Constants
*/

Const #BGCOLOR = $065686

/*
** Variables
*/

dial_min = 1
dial_max = 9

/*
** Brushes
*/

@BRUSH 1, "dial_bkg.png", {LoadAlpha = True}
@BRUSH 2, "dial.png", {LoadAlpha = True}
@BGPIC 1, "bkg.png"

/*
** Display
*/

@DISPLAY {Width = 800, Height = 600, Color = #BGCOLOR}


/*
** Script starts here!
*/

DisplayBGPic(1)
DisplayBrush(1, #CENTER, #CENTER)
DisplayBrush(2, #CENTER, #CENTER)

MakeButton(1, #SIMPLEBUTTON, 0, 0, 100, 100, {OnLeftMouseDown = p_DialRot, OnRightMouseDown = p_DialRot})


Function p_DialRot(msg)
    Switch msg.action
    Case "OnLeftMouseDown":
        DebugPrint("Clicked rotate left")
    Case "OnRightMouseDown":
        DebugPrint("Clicked rotate right")
    EndSwitch
EndFunction


EscapeQuit(True)


Repeat
    WaitEvent
Forever
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: MakeButton Error

Post by amyren »

You need to put the makebutton line below the function it calls.

And you probably should change OnLeftMouseDown to OnMouseDown
ocean77
Posts: 111
Joined: Mon Jan 28, 2019 8:34 pm

Re: MakeButton Error

Post by ocean77 »

amyren wrote: Tue May 04, 2021 5:55 pm You need to put the makebutton line below the function it calls.

And you probably should change OnLeftMouseDown to OnMouseDown
Of course... Always put the function before it's called. When will I learn? :lol:

Thanks.
Post Reply