Is there any way to pop to root window (main window or very first window on stack).
Ex: I have 4 windows say 1,2,3,4. "1" is being my root window and I traverse to 4th window. Now on some action event I want to Jump Back to Window 1 directly.
I went through this pebble documentation , did not get any way to do that.
But this is done in Pebble Default Alarm App, below are the steps:
Set the alarm - (Window 1)
Then after clicking select button it shows some "Menu List" - (Window 2)
Last item in menu list is "Snooze Delay"
Snooze Delay takes user to another Menulist to select snooze time-(Window 3)
After selecting snooze time it shows confirmation message takes user back to alarm screen (Window 1) automatically without user
interaction.
Can anyone please provide me pointers on this, how to achieve this behaviour.
Related
I have two windows in my application (document based), a main and secondary window. I want to keep the secondary window behind the main window unless the user clicks on it or the main window decides to show it (via a user pressed button).
The issue is that the secondary window has a modal sheet which makes it come to the foreground. I want to stop it from doing that.
Current solution:
Before the sheet appears I increase the main window's level by 1
After the sheet is done I decrease the main window's level by 1
Problems:
My timing of knowing when these sheets occur is bad and unreliable
The window flickers a bit
Notes:
I have tried making the secondary window a child window of the main one, however this links them too strongly, where dragging one drags the other and I do want the secondary window to surface when the user clicks on it.
I am trying to make a Blackjack helping application in MIT App Inventor. I want the user to select the 2 cards that he has by clicking one button that maps to a card value and then click another one (could be the same button) and then take that input of 2 cards along with an input of 1 dealer card for processing. How can I click a button and then have it wait for another button to be pressed?
use a counter variable
after clicking a button, add 1 to the counter
after clicking again, add again 1 to the counter
and only if counter = 2, then continue with your logic
Normally when you hover over a sub-menu (with the little arrow) on a CMenu menu item it delays briefly then shows the sub-menu items. Also, if you click the item before the delay timeout, it shows the sub menu items. I want the delay behavior, but I want a different behavior for the click. That is, I want the sub-menu itself (the one with the arrow) to be a clickable entity too, i.e. it has an ID and results in a WM_COMMAND and menu dismissal.
The idea is, the main sub-menu menu item is a "default", and the sub-menu items are modified versions, e.g. "print->" (defaulting to default printer), and sub-menu items like "print preview" "print to file" etc. Thanks for thoughts/suggestions.
edit:
IDR_MY_MENU MENUEX
BEGIN
POPUP "menu"
BEGIN
MENUITEM "&Something Else", ID_MENU_SOMETHING_ELSE
POPUP "&Print", ID_MENU_PRINT
BEGIN
MENUITEM "Print Pre&view", ID_MENU_PRINT_PREVIEW
MENUITEM "Print to &File", ID_MENU_PRINT_TO_FILE
END
MENUITEM "", -1, MFT_SEPARATOR
MENUITEM "&Bottom", ID_MENU_BOTTOM
MENUITEM "&Done", ID_MENU_DONE
END
END
I dont know if theres a better way as I last did this 2 years ago, but the way I solved the problem had one constraint: that you own the whole menu. If you do own the whole menu what you can do is create two columns (two columns in the menu/submenu that is, not a new submenu) and use the right column as a submenu and the left column as the default.
For future StackOverflowers, here's what I did...
Added a handler for OnInitMenuPopup and corresponding
ON_WM_INITMENUPOPUP(), although doing this messed up my UPDATE_COMMAND_UI handler but I was able to resolve that by moving that code into the OnInitMenuPopup handler.
In the OnInitMenuPopup handler, set a hook for the mouse SetWindowsHookEx(WH_MOUSE,...) (checking if one isn't already set because sub-menus can cause multiple calls)... and for each menu that initializes during the hook, push the HMENU onto a linked list.
In the mouse hook proc, checking the end of the list and working toward the front, verify each HMENU is still and active menu via IsMenu and remove it if it isn't. If there are no menus left, UnhookWindowsHook.
If there are menus left in the hook proc, check for WM_LBUTTONUP or WM_RBUTTONUP and see if happened over one of your menu items (because of coordinate mapping of screen versus sub-menu that I couldn't figure out I ended up simply cycling through the menu items via GetMenuItemRect and checking PtInRect to determine this).
If there is a click hit, do GetMenuItemInfo on the item, and if there's a hSubMenu for that item and it has an wID (and the wID doesn't match the sub-menu handle), simply post the id as a WM_COMMAND, post a WM_CANCELMODE to dismiss the menu, and disable the hook... Bingo!
So, seems to work fine and everything else functions like normal. The only issue at this point is a keyboard handler for selecting the item instead opening the sub-menu but I suspect the same idea works there as well.
Also, I added the main sub-menu text as the first item in the sub-menu list with a separator which added some clarity to what the menu was doing.
I'm trying to just open http://espn.go.com/ and then click on the "NBA" tab using TestComplete.
Could someone tell me how to do this to get me started?
Thanks!
In the example below, you need a unique property name and value of the tab you want to click to be able to find it on the page. You can find this by clicking the tab using the Object Spy tool in test complete.
function nbaTest(){
var nbaTab;
//open browser at espn page
Browsers.Item("iexplore").Run("http://espn.go.com");
//search page for nba tab using a unique property name and corresponding property value of the nba tab
nbaTab = Sys.browser('iexplore').page("*").Find(propertyName,propertyValue,"1000","TRUE");
if (nbaTab.exists){
nbaTab.click();
}
else{
Log.Warning("NBA tab not found");
return;
}
}
I've tried using TestComplete' Recording feature - the script looks reliable. This is what was recorded:
var page;
Browsers.Item(btIExplorer).Navigate("http://espn.go.com/");
page = Aliases.browser.Page("http://espn.go.com/");
page.Panel(1).Panel("content").Panel("nav_wrapper").Panel("nav_wrapper_container").Panel("nav_main").Link("lpos_sitenavdefault_lid_sitenav_nba").Click();
Keyword test to open http://espn.go.com/ and then click on the "NBA" tab:
Steps:
Run TestComplete (I'm using version 10)
Launch the recording (By clicking "Record New Test" or "Append to Test")
Open IE and type the URL http://espn.go.com/ on address bar -> Click NBA tab -> Close the browser
Stop recording and see the KeywordTest you recorded in TestComplete IDE
My KeywordTest I recorded was as below:
Run Browser Parametrized (Internet Explorer, "", pX64) "http://espn.go.com/", ... Launches the specified browser and opens the specified URL in it.
pageEspnTheWorldwideLeaderInSpor Wait Waits until the browser loads the page and is ready to accept user input.
linkTennisM HoverMouse 0, 0 Moves the mouse pointer over the 'linkTennisM' control.
pageEspnTheWorldwideLeaderInSpor Wait Waits until the browser loads the page and is ready to accept user input.
panelModContainerModTabsModNoFoo ClickTab "NBA" Selects the 'NBA' tab of the 'panelModContainerModTabsModNoFoo' tab control.
linkNba HoverMouse 8, 6 Moves the mouse pointer over the 'linkNba' control.
panelHeader HoverMouse 658, 25 Moves the mouse pointer over the 'panelHeader' control.
ToolbarWindow32 ClickItemXY "&File", 16, 8, false Clicks at point (16, 8) of the '&File' item of the 'ToolbarWindow32' toolbar.
PopupMenu Click "Exit" Moves the mouse cursor to the menu item specified and then simulates a single click.
Not sure if this will help but you might be able to automate the step of opening your browser as well.
I use:
Call Sys.OleObject("WScript.Shell").Exec("cmd /c start /MAX iexplore ""http://espn.go.com""")
From there, you can automate the rest as usual (might need to wait for the page to load here as well).
GUI: should a button represent the current state or the state to be achieved through clicking the button?
I've seen both and it sometimes misleads the user. what do you think?
The label on the button should reflect what the button does, i.e. it should describe the change the button makes.
For example, if you have a call logging system a button should say "Close Call" and the user can click it to close the call. The button should not have the label "Call is Open" and the user clicks to change the call status as that's very counter-intuitive, since the button is effectively doing the opposite to what it says on it.
In my opinion the label - and so the function - of a button should rarely, if ever, change. A button is supposed to be a like a physical button and they usually only do a single thing. (There are a few exceptions like play-pause on a media player where it's OK for the button label/icon to change, but at least this is copying a button from a real physical device.)
To carry on the example from above, I would say usually you would want two buttons, "Open Call" and "Close Call" and disable whichever one is not appropriate. Ideally you'd have a field elsewhere displaying the status of the call.
In summary, buttons are for doing things not for passing on information to the user.
The button should represent the action to be executed, not the state.
Some buttons are actions and are not ambiguous, like "Save", "Print" or "Enable user".
When a button represents a state that can be toggled, like Enable and Disable something, I do one of the following:
Change the button text, and make it always point to the state that will be achieved; (i.e. make the button point to actions, not states);
- Keep the button's text the same, but use one of those sticky buttons that will stay pressed, representing that the current state is "on" or "off". I prefer the former approach, though.
It should represent the action taken when clicking the button. States should always be presented by other means.
But I know what you mean. My car radio has buttons with text that shows the current state. It is really confusing.
This depends on the function which will be triggerd by the button click.
if the click changes the state of an entity i would suggest that the button represents the state the entity will enter after clicking the button
if the click triggers some kind of functionality the button should represent the function.
The appearance of the button is also a clue to its state. It should follow the standards of the environment if any exist (example, beveled edge / shadow appears on mouse click in Windows).