Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Making objects modal — Gideros Forum

Making objects modal

mikemike Member
edited November 2012 in General questions
As a Lua and Gideros programmer I am now 2 weeks old. Dipping my toes in the water, I've been looking for ways to make a sprite-based object 'modal'. That is, to give it full focus at the expense of all other visible objects on the screen. While I can see this being done laboriously by managing focus of each individual object, I am hoping there might be a less intensive method already available in gideros.
In this application, there will be a number of edit boxes on the screen. Some text entry via keypad, others will have popup lists for selection. While the popup list (sprite) is on screen, I don't want any of the edit boxes to be active.
1 - get off your lazy a*** and do the work; or
2 - ah, there's a you-beaut function called [name here] you can use
3 - here's a pointer to an example.

Cheers, Mike.


  • MellsMells Guru
    edited November 2012
    GiderosCodingEasy provides better control for Z-axis manipulation :
    --[[ z-axis manipulations ]]--
    function Sprite:bringToFront()
    	local parent = self:getParent()
    	if parent then
    	return self
    You can even save the index of your sprite in the hierarchy (Sprite:getIndex()), add it to a layer on top of everything else in your game (Sprite:addChild()), and once all your actions are done add it again to the original parent by using the previously stored index(Sprite:addChildAt()).

    Note : You probably know it, but you don't need to remove a Sprite from his parent before adding it to another parent.

    Intercept clics
    You can set your top layer (for example an invisible shape) to stop events propagation.

    This is how I do it, but I am not the most knowledgeable member of this community so please wait a little for more answers (but you can try my solution in the meantime ;) ).
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • as @Mells said, you can stop propagation of events to prevent clicks on other elements in background.

    Or you could use native alert messages using AlertDialog class or TextInputDialog class for text input, both of them are also modal
  • Thanks guys. Appreciate the response times - fantastic.
    Actually shortly after posting I came up with the 'invisible shape' solution myself. In fact, if you colour fill it (say, black) and make alpha just right, it gives the appearance of 'greying out' the other objects, thus making it obvious they aren't available - beautiful.

    Likes: ar2rsawseen

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.