Double click on a picture

Discuss GUI programming with the RapaGUI plugin here
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Double click on a picture

Post by papiosaur »

Hello,

is it possible to double click on a brush inserted between <rectangle/> to do an action please ?

I have tried many thing but nothing work...

Thanks for your help.
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Double click on a picture

Post by plouf »

have you try to display it using Button.Icon (aka do it buton) or inside a html class ?

both these classes provide events
Christos
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Double click on a picture

Post by papiosaur »

Thanks plouf!

I will try them and comeback here
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Double click on a picture

Post by papiosaur »

Hello plouf,

i have tried the 2 solutions but without success...
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Double click on a picture

Post by papiosaur »

ok, seems work ok with Button.Icon :-)

Thanks a lot plouf!
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Double click on a picture

Post by papiosaur »

Is it possible to change the picture of the button with moai.Set() ?

I try but don't work...

work with picture class...
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Double click on a picture

Post by papiosaur »

ok solved with LoadBrush()
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Double click on a picture

Post by papiosaur »

sorry, doesn't work, i can't update the brush in the button...

Any ideas please?
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Double click on a picture

Post by airsoftsoftwair »

papiosaur wrote: Tue Jun 27, 2023 3:13 pm sorry, doesn't work, i can't update the brush in the button...

Any ideas please?
Button.Icon has an applicability of I so moai.Set() won't work. The problem could be circumvented by detaching, re-creating and re-attaching the button but that is a rather ugly solution and will probably cause a visible visual glitch to the GUI.

To come back to your original problem: I agree that RapaGUI's Image class should provide some event handlers like mouse clicks. I'll add this for the next update. It has already been requested here.
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Double click on a picture

Post by plouf »

best way is to wait Adnreas to implement it, in the mean time you can use HOllywood display as a workaround
here is an example with single click

Code: Select all

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
					
	<window id="win" title="Tasks"  >
		<vgroup>
		<rectangle />
		<button id="ok">OK</button>

			<hollywood display="2" width="150" height="150"/>
		<button id="no">NO</button>


		</vgroup>
	</window>
</application>
]]

@REQUIRE "RapaGUI"

CreateDisplay(2,{color=#RED,x=150,y=150})
SelectDisplay(2)
CreateBrush(1,15,15,#GREEN)
CreateBrush(0,30,30,#BLUE)
DisplayBrush(1,20,20)


moai.CreateApp(xml$)
Function MouseUp(msg)
	DebugPrint("clicl")
	DisplayBrush(brush,20,20)
	brush = 1-brush
EndFunction


InstallEventHandler({RapaGUI = p_eventFunc,OnMouseUp=MouseUp})

Repeat
	WaitEvent
Forever
Christos
Post Reply