This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
IPIPP's profile picture

[any upcoming version] Better Touchscreen Monitors

Started by IPIPP, 06 January 2013 - 09:18 PM
IPIPP #1
Posted 06 January 2013 - 10:18 PM
Hi,
I have a Problem, becousse some Programs which are useing mouse need both mouse-buttons.
So, my Idea was to make Advanced Monitors Unbreakable with the blank hand, so you could use every mouse-click event
Also it would be cool if there was a command like
monitor.enableTouchscreen()
and
monitor.disableTouchscreen()

So, what's your mind to this topic?
Pleease reply.
Sebra #2
Posted 06 January 2013 - 11:18 PM
Why you need to disable it? Just ignore events.
I'm not sure about both mouse keys. It seems touchscreens should not have it.
Cloudy #3
Posted 07 January 2013 - 01:02 AM
Not possible I'm afraid. You will have to rewrite the program based on only a touch input.
Left4Cake #4
Posted 11 January 2013 - 04:18 AM
Would it be possible to make a tool (say a stylus) that dose not do damage to any block.

of course realistically real touch screens don't really have left and right click.
theoriginalbit #5
Posted 11 January 2013 - 04:24 AM
Not possible I'm afraid. You will have to rewrite the program based on only a touch input.
Not sure if its been suggested before, but what about a crouch click? would that be 'possible' ?
Cloudy #6
Posted 11 January 2013 - 08:00 AM
Possible but I don't think it would make any sense.
wilcomega #7
Posted 11 January 2013 - 08:34 AM
i real life you cant do a right click on a touch screen.
Cloudy #8
Posted 11 January 2013 - 09:19 AM
i real life you do a right click on a touch screen.

What?
wilcomega #9
Posted 11 January 2013 - 09:58 AM
changed my post….. lol
theoriginalbit #10
Posted 11 January 2013 - 10:37 AM
Possible but I don't think it would make any sense.
Oh I know it doesn't make any sense… just wanted to see if it was possible ;)/>
zekesonxx #11
Posted 11 January 2013 - 10:38 AM
i real life you do a right click on a touch screen.

What?

In real life you only have one click on a touch screen, meaning you can't right-click.
Cloudy #12
Posted 11 January 2013 - 10:55 AM
Yeah, after he edited is post it made more sense.

That is the crux of the matter - right clicks just wouldn't make sense on a monitor.
Kingdaro #13
Posted 16 January 2013 - 03:43 AM
Actually, I used to own a touch screen, and you could right click by tapping and holding for about a second. If you wanted to, you could make some sort of wrapper similar to the monitor program that makes it so that if the user taps the screen two or more times within a short time period (right click holding to repeatedly click) it'd register a right click. That would be problematic if you actually meant to touch that part of the screen twice, though.
theoriginalbit #14
Posted 16 January 2013 - 04:04 AM
Actually, I used to own a touch screen, and you could right click by tapping and holding for about a second. If you wanted to, you could make some sort of wrapper similar to the monitor program that makes it so that if the user taps the screen two or more times within a short time period (right click holding to repeatedly click) it'd register a right click. That would be problematic if you actually meant to touch that part of the screen twice, though.
Triple-click maybe? however any variant of this can be done in code and doesn't really need an impl from the mod end…
Orwell #15
Posted 16 January 2013 - 11:48 AM
Actually, I used to own a touch screen, and you could right click by tapping and holding for about a second. If you wanted to, you could make some sort of wrapper similar to the monitor program that makes it so that if the user taps the screen two or more times within a short time period (right click holding to repeatedly click) it'd register a right click. That would be problematic if you actually meant to touch that part of the screen twice, though.
Triple-click maybe? however any variant of this can be done in code and doesn't really need an impl from the mod end…
He's referring to the monitor program, so I think he's talking about a Lua side implementation.
theoriginalbit #16
Posted 16 January 2013 - 12:47 PM
He's referring to the monitor program, so I think he's talking about a Lua side implementation.

And what I'm saying is its possible to do it in code anyways… here is an example I just whipped up… it could be improved slightly, but its works, and thats all i wrote it for, to show it can be done…
Spoiler


local timesTouched = 0
local waitingForClicks = false
local waitingPos = {}
os.startTimer(0.4)
while true do
  local event = { os.pullEvent() }

  if event[1] == "monitor_touch" then
    local xPos = event[3]
    local yPos = event[4]

    timesTouched = timesTouched + 1

    if timesTouched < 2 then
      waitingForClicks = true
      waitingPos = {xPos, yPos}
    elseif timesTouched == 2 then
      os.queueEvent( "mouse_click", 2, xPos, yPos )
      waitingForClicks = false
    end
  elseif event[1] == "mouse_click" then
    print( event[2].." : "..event[3].." : "..event[4] )
  elseif event[1] == "timer" then
    timesTouched = 0
    if waitingForClicks then
      os.queueEvent( "mouse_click", 1, waitingPos[1], waitingPos[2] )
    end
    waitingForClicks = false
    os.startTimer(0.4)
  end
end
Orwell #17
Posted 16 January 2013 - 12:55 PM
He's referring to the monitor program, so I think he's talking about a Lua side implementation.

And what I'm saying is its possible to do it in code anyways… here is an example I just whipped up… it could be improved slightly, but its works, and thats all i wrote it for, to show it can be done…
Spoiler


local timesTouched = 0
local waitingForClicks = false
local waitingPos = {}
os.startTimer(0.4)
while true do
  local event = { os.pullEvent() }

  if event[1] == "monitor_touch" then
	local xPos = event[3]
	local yPos = event[4]

	timesTouched = timesTouched + 1

	if timesTouched < 2 then
	  waitingForClicks = true
	  waitingPos = {xPos, yPos}
	elseif timesTouched == 2 then
	  os.queueEvent( "mouse_click", 2, xPos, yPos )
	  waitingForClicks = false
	end
  elseif event[1] == "mouse_click" then
	print( event[2].." : "..event[3].." : "..event[4] )
  elseif event[1] == "timer" then
	timesTouched = 0
	if waitingForClicks then
	  os.queueEvent( "mouse_click", 1, waitingPos[1], waitingPos[2] )
	end
	waitingForClicks = false
	os.startTimer(0.4)
  end
end
*snip*
Got it. :)/> I just thought it was kind of obvious that it could be done. :P/> It's a simple finite state machine afterall. But you're example is quite nice. :)/> And I got the point. :D/>
theoriginalbit #18
Posted 16 January 2013 - 01:00 PM
Got it. :)/> I just thought it was kind of obvious that it could be done. :P/> It's a simple finite state machine afterall. But you're example is quite nice. :)/> And I got the point. :D/>
Some people might not realise that it can be done, hence me stating it… Thanx :)/>