When two CCMenuItem overlaps each other, is it possible to prioritise one over the other? - ios4

I have 2 CCMenuItems A and B
A is a screen-wide transparent button
and B is an actual button that is set to visible when A is touched
Currently, when I'm touching B, A responds with it's selector method and basically B does not respond because the touch is 'taken' by A's selector.
I need B to be responding even though A is a screen-wide button so- Is it possible to prioritise B's selector when it is pushed?
To summarize, I'm toggling B's visibility via A and would like to be able to use B when it is visible.
Is this possible? How can it be done?

for me worked adding one menu in one layer and another menu in other layer

I)
Yes, You can prioritize your CCMenuItems by setting Z-Order.
First button that gets touch is the button with lowest Z-Order.
II)
And if you want to prioritize your CCMenus, you need to setTouchPriority(..) them.
The less priority you give, the earlier your CCMenu will handle the touch. (CCMenu's default value is -128 ).

Either you can set the buttons yourButton.isEnabled to NO or you can just move the A-button off the scene when you don't want it to take input.

It's possible to use an additional CCMenu with a higher z-order for the button B.

Related

FLTK's Fl_Scroll - run code in reaction to scrolling happening?

I am using FLTK 1.3, displaying a single Flex column with a number of Flex rows inside a Fl_Scroll. I want to do something to rows that were outside of the visible area when they scroll into view. But I cannot figure out how to do that. There is no event emitted when the scroll position changes (as far as I can see) nor does a callback on the scroll seem to do anything.
The only solution I can think of is something like using the column's, scroll's, or window's callback to get informed of all UI events (such as move, key up, leave, ..) and use them to check whether the scoll's yposition has changed from the last time and run the code I need if it is....
But there surely must be a better way?
Thank you!!!

How can add space-key to jump for Platform behavior in construct 2?

I'm using the Platform Behavior in Construct 2 for a Windows 10 game. In addition to the arrow key, I would like to use the Space bar to get the sprite to jump. Can I tell it to call into the Platform behavior somehow or get it to let me map space bar as well as up arrow to 'jump'?
You certainly can. You can use an action called "Simulate Control" to simulate pressing left, right, or up. So as your event, use Keyboard->on Key Pressed (Space Bar). Then for the action Player->Simulate Control (Up Arrow). This will allow you to press space bar to have your character jump. Additionally, you can turn off default controls for the platform behavior and do custom controls for left, right, and up using the same strategy.
The best way to go about doing this is by adding an event that handles the Space Button. Make sure to add the keyboard object in your layout, and in the event sheet, you want to make an event that handles the keyboard -> on key pressed (choose the spacebar when asked) -> choose whatever object you want to jump with the Platform behavior -> Set Vector Y to whatever increment you'd like to jump. Be sure to list this value as negative. The y-axis in C2 is inverted, so negative numbers mean up.
Hope this helps!

Cadence Virtuoso Layout L phantom objects

I have a cell (call it A) which is used once in a hierarchically higher cell (call it P). When I place A in P, its borders are rather larger than the actual content of A. When I descend to A and zoom-fit, it is way zoomed out, indicating there is something present way out on the edges.
I may have dragged objects there at one point but currently there is nothing visible. It is driving me crazy in terms of aligning objects, etc.
Is there any way to clean this up or something?
If I recall Cadence used to have a problem with leaving steiners behind when you moved routes. They are not visible but the db treats them as real objects for the bbox calculation. According to Cadence, deleting the objects should not harm anything. Open the layout in edit mode and paste this code into the CIW. This will delete all the steiner objects in your layout. If this was the root cause after saving you should see the bbox return to normal.
cv=geGetEditCellView()
foreach( item cv~>steiners
dbDeleteObject( item )
)
This thread may be considered "dead," but hopefully this helps.
It is possible the layers that are not visible are turned off.
To turn them on, go to the layers pane on the left. (If it is not there you can turn it on by going to Window —> Assistants —> Layers)
You can then click the drop down arrow in the top right corner and click Edit Valid Layers.
Then, click all valid in the Set Valid Layers popup. Click Ok.
Finally, check the Used Layers Only checkbox in the Layers pane. Look for any layers that weren't there before that you don't need.
Usually it happens when you draw the cell in LayoutXL, particularly when you insert pins.
Layer and purpose in these pins are selected separately for some reason, that is why it is easy to enter "impossible" combination.
Nothing happens, then you do it again and continue drawing. But there are several invisible squares that will continuously frustrate your inner perfectionist. You do the following:
Open this cell's layout, switch to Virtuoso window and enter:
lppList=list()
then:
foreach(shape hiGetCurrentWindow()~>cellView~>shapes if( (member(shape~>lpp lppList)==nil) then lppList=cons(shape~>lpp lppList)))
You have created the list with all layers in this layout, you can view it by entering:
lppList
You'll get something like this:
(("NW" "drawing")
("NP" "drawing")
("weird" "guy")
("M1" "pin")
("M3" "pin")
)
If you find a weird guy in this company, just enter the following command:
foreach(shape hiGetCurrentWindow()~>cellView~>shapes if((shape~>lpp == list("weird" "guy")) shape~>lpp = list("prBoundary" "drawing")))
If you see that some squares, labels (or whatever unseen before) appears as prBoundary, just delete it, save, and your layout will be small and shiny again.

Web accessibility: does it make sense for focus to go to another element other than the whole page frame or the first focusable element on the page?

My question is about focus management for web accessibility. When we launch a popup/dialog, does focus always need to go to the first focusable element for accessibility reasons or is it acceptable to set focus on an element that we think the user is more likely to want to work with?
For example, if a dialog starts with an input field and a cancel link followed by a dropdown and we think the user would most likely want to work with the dropdown when the dialog loads, is it ok to set focus on the dropdown element? In this case, how would the user know about the previous focusable elements existing on the dialog? But, if the dropdown is where 80% of the users will want to be when the dialog is launched, it doesn't make much sense placing focus on the initial input field...
thoughts?
Based on my research and what public opinion is: http://webaim.org/discussion/mail_thread?thread=5435 it seems like where the focus goes for a modal dialog/popup would depend on the usecase. For example, it makes sense to set focus on the search input field for www.google.com although there are preceding elements that the user can interact with -- this maximizes usability for screen reader and keyboard only users. But, in general the focus needs to go to the first element the user can interact with -- depends on the scenario.
I would caution against setting focus to anything other than the first form element or headings/content that introduce the form. See WCAG 2.0 Focus Order:
If a Web page can be navigated sequentially and the navigation
sequences affect meaning or operation, focusable components receive
focus in an order that preserves meaning and operability. (Level A)
While the case you present is I think an edge case, I think the focus order rules still apply. If you think that most users will want to interact with the select why not put it first in the form rather than set focus to an element in the middle of the form?

Group box with title as Check box

I am using Visual Studio 6.0 (VC++ with MFC) in Windows XP platform. I am trying to create a group box with the title of the group box as a check box. My intention is this: If the check box is enabled, the controls inside the group box should be enabled; or else disabled.
Is this possible to accomplish? If yes, please give me some directions.
Thanks.
There are a few things you can try, depending on how true you want to stay to your idea and how much work you are prepared to put into the effort:
Simple method
Use a normal group box, and then inside this make the first item be the checkbox. This is simple to accomplish, but you lose the goal of having the checkbox as the title.
Funky drawing method 1
Use a normal group box, then in the space over where you know the title is to go, place your checkbox. You will have to perform some tricky calculation to get it to fit in nicely and draw well without flicker.
Funky drawing method 2
Use some form of superclass or subclass/subclass on the group box. You can override the WM_PAINT handler to draw in only the frame for the group box. Place a normal checkbox in the place where you know the title is to go. This should work better because you will have more control over the drawing, but it is likely to be tricky to get right. In my experience, subclassing is lower risk to implement than superclassing.
Are you using the Dialog editor? If so, put down the group box. Next, on top of it, put a check box over the line of the group box. Edit the resource to set the Z order, or do it in code. You want the checkbox to be on top of the group box. Add a handler for the checkbox and enable / disable controls depending on the check box state.
I wrote one called CGroupCheck a few years back and it's available from CodeProject: http://www.codeproject.com/KB/buttons/groupcheck123.aspx

Resources