Discussion Forums  >  Uncategorized

Replies: 3    Views: 325

Kyle McAllister
Aspiring developer
Profile
Posts: 20
Reg: Nov 03, 2010
Columbia, Misso...
200
08/26/11 12:36 PM (14 years ago)

Making blue box pop up

Is it possible to make the common blue box pop up with information I input if the user selects a specific item from a menu? I want to have the box pop up with a door access code (commonly only 4-5 digits) and dont want to have to use a word document. Any suggestions?
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
08/26/11 02:04 PM (14 years ago)
Not without doing some tinkering with the code. To achieve something similar, have your menu list item open up a custom html page that your create. It can look however you want it to (within the limits of HTML).
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/26/11 10:43 PM (14 years ago)
Alert dialogues in iOS do work nice for these quickie items. Like @Parker mentioned, it does take some tinkering to get somethign like this to work. The trick is identifying what button or menu item was tapped by the user so you can intercept the event and not load a new screen but instead show an alert. There are a couple buzztouch methods you can use to determine this. One will help with determining what menu item was tapped, the other in intercepting the event so you can show teh alert. First: Have a look at the handleTapToLoadScreen method in the BT_viewControllerManager.m file. This is the method that fires when a button or menu item is tapped. This is the method you'll want to modify. Open the console with the app running and tap a menu item. Clear the console before you tap a menu item so you can see the output easier (lots of stuff is output to the console). So, clear the console, tap an item. Look for: 'the menu/button tapped is itemId: 33828JFKDKFDFJ' (whatever the id is, I typed a random one here. The idea is that the console will give you the unique id of the menu or button item you tapped. Next, you'll need to figure out the id of the thing they tapped. Do this in your control panel online. Create a menu item so it appears on a menu. The screen you load for this item isn't going to be used so you may need to create a dummy-screen when adding the item. Pick anything, like Call Us. It doesn't matter because we are going to ignore the screen to load. Next, mouse over the menu item in the list so you can copy the URL for that menu item. Clicking it will open a window for more properties, you don't need to do this, just copy the URL to your mouse. Next, open a new browser window and paste the URL in the address bar. Now you can see the URL easier. Look for: BT_menuItemId=C4608F0B7E2017CC676DADA in the URL. The BT_menuItemId is the id of the thing we want to intercept. So, back in Xcode, we now know the menu item to look for when it's tapped and the handleTapToLoadScreen method is fired. Back in BT_viewControllerManager.m, look at line 144. You'll see a simple code block that checks to see if the loadScreenWithItemId for that menu item is 'none'. Copy that block and paste it below on line 147 or so. Now, modify it to look for the itemId and not the loadScreenWithItemId like this: if([[BT_strings getJsonPropertyValue:theMenuItemData.jsonVars:@itemId:@] isEqualToString:@your menu item id]){ .....show the alert here return; } To show the alert you can copy another few lines of code from around line 174. This section of code shows and alert for something else. We want to show an alert with a custom message. When you're done it will look something like... if([[BT_strings getJsonPropertyValue:theMenuItemData.jsonVars:@itemId:@] isEqualToString:@your menu item id]){ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@this is the alert title message:@this is the alert message delegate:nil cancelButtonTitle:@OK otherButtonTitles:nil]; [alertView setTag:101]; [alertView show]; [alertView release]; return; } The syntax in the forum gets screwy so you'll need to figure out where to put the quotes but that should get you headed in the right direction ;-)
 
Kyle McAllister
Aspiring developer
Profile
Posts: 20
Reg: Nov 03, 2010
Columbia, Misso...
200
like
08/27/11 11:06 AM (14 years ago)
Thanks David. You are awesome!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.