Search Results

Search found 28345 results on 1134 pages for 'custom event'.

Page 32/1134 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Google Chrome Extensions: Launch Event (part 2)

    Google Chrome Extensions: Launch Event (part 2) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay technical leads for the Google Chrome extensions team present a quick history of the extensions system of Google Chrome and discuss its design principles, focusing on why extensions are webby. From: GoogleDevelopers Views: 3035 12 ratings Time: 05:25 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 3)

    Google Chrome Extensions: Launch Event (part 3) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Erik Kay and Aaron Boodman, technical leads for the Google Chrome Extensions team demonstrate how to build, debug and share a Google Chrome extension. From: GoogleDevelopers Views: 2974 13 ratings Time: 08:28 More in Science & Technology

    Read the article

  • Applications: How to create a custom dialog box for Windows Mobile 6 (native)

    - by TechTwaddle
    Ashraf, on the MSDN forum, asks, “Is there a way to make a default choice for the messagebox that happens after a period of time if the user doesn't choose (Clicked ) Yes or No buttons.” To elaborate, the requirement is to show a message box to the user with certain options to select, and if the user does not respond within a predefined time limit (say 8 seconds) then the message box must dismiss itself and select a default option. Now such a functionality is not available with the MessageBox() api, you will have to write your own custom dialog box. Surely, creating a dialog box is quite a simple task using the DialogBox() api, and we have been creating full screen dialog boxes all the while. So how will this custom message box be any different? It’s not much different from a regular dialog box except for a few changes in its properties. First, it has a title bar but no buttons on the title bar (no ‘x’ or ‘ok’ button on the title bar), it doesn’t occupy full screen and it contains the controls that you put into it, thus justifying the title ‘custom’. So in this post we create a custom dialog box with two buttons, ‘Black’ and ‘White’. The user is given 8 seconds to select one of those colours, if the user doesn’t make a selection in 8 seconds, the default option ‘Black’ is selected. Before going into the implementation here is a video of how the dialog box works; Custom dialog box To start off, add a new dialog resource into your application, size it appropriately and add whatever controls you need to the dialog. In my case, I added two static text labels and two buttons, as below; Now we need to write up the window procedure for this dialog, here is the complete function; BOOL CALLBACK CustomDialogProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam) {     int wmID, wmEvent;     PAINTSTRUCT ps;     HDC hdc;     static int timeCount = 0;     switch(uMessage)     {         case WM_INITDIALOG:             {                 SHINITDLGINFO shidi;                 memset(&shidi, 0, sizeof(shidi));                 shidi.dwMask = SHIDIM_FLAGS;                 //shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU;                 shidi.dwFlags = SHIDIF_SIPDOWN | SHIDIF_EMPTYMENU;                 shidi.hDlg = hDlg;                 SHInitDialog(&shidi);                 SHDoneButton(hDlg, SHDB_HIDE);                 timeCount = 0;                 SetWindowText(GetDlgItem(hDlg, IDC_STATIC_TIME_REMAINING), L"Time remaining: 8 second(s)");                 SetTimer(hDlg, MY_TIMER, 1000, NULL);             }             return TRUE;         case WM_COMMAND:             {                 wmID = LOWORD(wParam);                 wmEvent = HIWORD(wParam);                 switch(wmID)                 {                     case IDC_BUTTON_BLACK:                         KillTimer(hDlg, MY_TIMER);                         EndDialog(hDlg, IDC_BUTTON_BLACK);                         break;                     case IDC_BUTTON_WHITE:                         KillTimer(hDlg, MY_TIMER);                         EndDialog(hDlg, IDC_BUTTON_WHITE);                         break;                 }             }             break;         case WM_TIMER:             {                 if (wParam == MY_TIMER)                 {                     WCHAR wszText[128];                     memset(&wszText, 0, sizeof(wszText));                     timeCount++;                     //8 seconds are over, dismiss the dialog, select def value                     if (timeCount >= 8)                     {                         KillTimer(hDlg, MY_TIMER);                         EndDialog(hDlg, IDC_BUTTON_BLACK_DEF);                     }                     wsprintf(wszText, L"Time remaining: %d second(s)", 8-timeCount);                     SetWindowText(GetDlgItem(hDlg, IDC_STATIC_TIME_REMAINING), wszText);                     UpdateWindow(GetDlgItem(hDlg, IDC_STATIC_TIME_REMAINING));                 }             }             break;         case WM_PAINT:             {                 hdc = BeginPaint(hDlg, &ps);                 EndPaint(hDlg, &ps);             }             break;     }     return FALSE; } The MSDN documentation mentions that you need to specify the flag WS_NONAVDONEBUTTON, but I got an error saying that the value could not be found, so we can ignore this for now. Next up, while calling SHInitDialog() for your custom dialog, make sure that you don’t specify SHDIF_DONEBUTTON in the dwFlags member of the SHINITDIALOG structure, this member makes the ‘ok’ button appear on the dialog title bar. Finally, we need to call SHDoneButton() with SHDB_HIDE flag to, well, hide the Done button. The ‘Done’ button is the same as the ‘ok’ button, so this step might seem redundant, and the dialog works fine without calling SHDoneButton() too, but it’s better to stick with the documentation (; So you can see that we have followed all these steps above, under WM_INITDIALOG. We also setup a few things like a variable to keep track of the time, and setting off a one second timer. Every time the timer fires, we receive a WM_TIMER message. We then update the static label displaying the amount of time left to the user. If 8 seconds go by without the user selecting any option, we kill the timer and end the dialog with IDC_BUTTON_BLACK_DEF. This is just a #define’d integer value, make sure it’s unique. You’ll see why this is important. If the user makes a selection, either Black or White, we kill the timer and end the dialog with corresponding selection the user made, that is, either IDC_BUTTON_BLACK or IDC_BUTTON_WHITE. Ok, so now our custom dialog is ready to be used. I invoke the custom dialog from a menu entry in the main windows as below, case IDM_MENU_CUSTOMDLG:     {         int ret = DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CUSTOM_DIALOG), hWnd, CustomDialogProc);         switch(ret)         {             case IDC_BUTTON_BLACK_DEF:                 SetWindowText(g_hStaticSelection, L"You Selected: Black (default)");                 break;             case IDC_BUTTON_BLACK:                 SetWindowText(g_hStaticSelection, L"You Selected: Black");                 break;             case IDC_BUTTON_WHITE:                 SetWindowText(g_hStaticSelection, L"You Selected: White");                 break;         }         UpdateWindow(g_hStaticSelection);     }     break; So you see why ending the dialog with the corresponding value was important, that’s what the DialogBox() api returns with. And in the main window I update a static text label to show which option was selected. I cranked this out in about an hour, and unfortunately don’t have time for a managed C# version. That will have to be another post, if I manage to get it working that is (;

    Read the article

  • New UK SQL Server community event

    - by GavinPayneUK
    I’m pleased to announce that with the support of VMware I will be holding a new UK SQL Server community event in January 2011. Wednesday January 19th 2011 6.45-9.00pm Free registration required, free parking on-site Registration link here SQL Server in the Evening , hosted at VMware’s UK headquarters in Frimley in Surrey, will cover contemporary technology topics for those using SQL Server in 2011, as well as providing a chance to make and meet with SQL Server community friends. The event will have...(read more)

    Read the article

  • Google Chrome Extensions: Launch Event (part 2)

    Google Chrome Extensions: Launch Event (part 2) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay technical leads for the Google Chrome extensions team present a quick history of the extensions system of Google Chrome and discuss its design principles, focusing on why extensions are webby. From: GoogleDevelopers Views: 3036 12 ratings Time: 05:25 More in Science & Technology

    Read the article

  • UPK Breakfast Event: "Getting It Done Right" - Independence, Ohio - November 8th

    - by Karen Rihs
    Join us for a UPK “Getting It Done Right” Breakfast Briefing Come for Breakfast. Leave Full of Knowledge. Join Oracle and Synaptis for a breakfast briefing event before you begin your day, and leave full with knowledge on how to reduce risk and increase user productivity. Oracle’s User Productivity Kit (UPK) can provide your organization with a single tool to provide learning and best practices for each area of the business and help ensure you’re “Getting It Done Right.”Learn from Deb Brown, Senior Solutions Consultant, Oracle, as she shows the UPK tool that can save project teams thousands of hours through automation as well as provide greater visibility into application rollouts and business processes. Also hear from a UPK Customer as they share their company’s success with Oracle UPK.  Learn how UPK insures rapid user adoption; significantly lowers development, system testing, and user enablement time and costs; and mitigates project risk. Finally, Pat Tierney, Oracle Practice Director - Synaptis and Jordan Collard, VP Sales - Synaptis, will conclude with an outline of their success as a UPK implementation partner. Register Now Thursday,November 8, 20127:30 a.m. – 10:00 a.m.Embassy Suites Cleveland – Rockside5800 Rockside Woods BoulevardIndependence, OH 44131Directions Agenda 7:30 a.m. Event Arrival / Registration. Breakfast Served. 8:00 a.m. Deb Brown, Senior Solutions Consultant, Oracle Oracle UPK – A Closer Look at Getting It Done, Right. Ensure End User Adoption. 8:40 a.m. UPK Customer Success Story 9:30 a.m. Pat Tierney, Oracle Practice Director - Synaptis and Jordan Collard, VP Sales - Synaptis – Implementation Partner - Using Oracle UPK Before, During and After Application Rollouts 9:50 a.m. Wrap Up   Don’t miss this special Breakfast Briefing and get a jump start on Oracle UPK technology. Please call 1.800.820.5592 ext. 11030 or Click here to RSVP for this exclusive event! Sponsored bySynaptisSynaptis is an Oracle Gold Partner, providing UPK training, implementation, content creation and post go-live support for organizations since 1999.     If you are an employee or official of a government organization, please click here for important ethics information regarding this event.  

    Read the article

  • Google Chrome Extensions: Launch Event (part 4)

    Google Chrome Extensions: Launch Event (part 4) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay, technical leads for the Google Chrome extensions team discuss the UI surfaces of Google Chrome extensions and the team's content not chrome philosophy. They also highlight the smooth, frictionless install and uninstall process for Google Chrome's extensions system and present the team's initiatives in the space of security and performance. From: GoogleDevelopers Views: 2968 12 ratings Time: 15:44 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 3)

    Google Chrome Extensions: Launch Event (part 3) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Erik Kay and Aaron Boodman, technical leads for the Google Chrome Extensions team demonstrate how to build, debug and share a Google Chrome extension. From: GoogleDevelopers Views: 2975 13 ratings Time: 08:28 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 1)

    Google Chrome Extensions: Launch Event (part 1) Video Footage from the Google Chrome Extensions launch event on 12/09/09. In this part, Brian Rakowski, product management director, provides an update on Google Chrome and explains why extensions are important for the Google Chrome team. From: GoogleDevelopers Views: 5167 17 ratings Time: 04:39 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 6)

    Google Chrome Extensions: Launch Event (part 6) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Nick Baum, product manager for Google Chrome's extension system presents the gallery approval process, gives tips to extensions developers on how to make their extension successful and discusses the team's short term plans. From: GoogleDevelopers Views: 5659 17 ratings Time: 08:42 More in Science & Technology

    Read the article

  • Understanding Event Handlers in ASP.NET 3.5

    ASP.NET uses event handlers to control certain behaviors. They re responsible for programs acting in certain predictable ways. If you want to master ASP.NET programming you need to learn more about event handlers. This article will introduce you to the basics.... Cloud Servers in Demand - GoGrid Start Small and Grow with Your Business. $0.10/hour

    Read the article

  • Google Chrome Extensions: Launch Event (part 5)

    Google Chrome Extensions: Launch Event (part 5) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Xmarks, ebay and Google Translate present their experience developing an extension for Google Chrome. From: GoogleDevelopers Views: 3039 18 ratings Time: 10:30 More in Science & Technology

    Read the article

  • Additional Columns in StreamInsight Event Flow Debugger

    This tool is excellent when investigating what is going on in your StreamInsight Streams.  I was looking through the menu items recently and went to Query => Event Fields I found that there were a couple of columns not added by default to the event viewer (Reminds me of the fact that the Variables viewer in SSIS hides columns also) Latency NewEndTime EnqueueTime Here they all are together.     This gives us even more information about what is going on

    Read the article

  • Event Driven Behavior Tree: deterministic traversal order with parallel

    - by Heisenbug
    I've studied several articles and listen some talks about behavior trees (mostly the resources available on AIGameDev by Alex J. Champandard). I'm particularly interested on event driven behavior trees, but I have still some doubts on how to implement them correctly using a scheduler. Just a quick recap: Standard Behavior Tree Each execution tick the tree is traversed from the root in depth-first order The execution order is implicitly expressed by the tree structure. So in the case of behaviors parented to a parallel node, even if both children are executed during the same traversing, the first leaf is always evaluated first. Event Driven BT During the first traversal the nodes (tasks) are enqueued using a scheduler which is responsible for updating only running ones every update The first traversal implicitly produce a depth-first ordered queue in the scheduler Non leaf nodes stays suspended mostly of the time. When a leaf node terminate(either with success or fail status) the parent (observer) is waked up allowing the tree traversing to continue and new tasks will be enqueued in the scheduler Without parallel nodes in the tree there will be up to 1 task running in the scheduler Without parallel nodes, the tasks in the queue(excluding dynamic priority implementation) will be always ordered in a depth-first order (is this right?) Now, from what is my understanding of a possible implementation, there are 2 requirements I think must be respected(I'm not sure though): Now, some requirements I think needs to be guaranteed by a correct implementation are: The result of the traversing should be independent from which implementation strategy is used. The traversing result must be deterministic. I'm struggling trying to guarantee both in the case of parallel nodes. Here's an example: Parallel_1 -->Sequence_1 ---->leaf_A ---->leaf_B -->leaf_C Considering a FIFO policy of the scheduler, before leaf_A node terminates the tasks in the scheduler are: P1(suspended),S1(suspended),leaf_A(running),leaf_C(running) When leaf_A terminate leaf_B will be scheduled (at the end of the queue), so the queue will become: P1(suspended),S1(suspended),leaf_C(running),leaf_B(running) In this case leaf_B will be executed after leaf_C at every update, meanwhile with a non event-driven traversing from the root node, the leaf_B will always be evaluated before leaf_A. So I have a couple of question: do I have understand correctly how event driven BT work? How can I guarantee the depth first order is respected with such an implementation? is this a common issue or am I missing something?

    Read the article

  • Sending notification after an event has remained open for a specified period

    - by Loc Nhan
    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Enterprise Manager (EM) 12c allows you to create an incident rule to send a notification and/or create an incident after an event has been open for a specified period. Such an incident rule will help prevent premature alerts on issues that may correct themselves within a certain amount of time. For example, there are some agents in an unstable network area, and often there are communication failures between the agents and the OMS lasting three, four minutes at a time. In this scenario, you may only want to receive alerts after an agent in that area has been in the Agent Unreachable status for at least five minutes. Note: Many non-target availability metrics allow users to specify the “number of occurrences” or the number of consecutive times metric values reach thresholds before a notification is sent. It is best to use the feature for such metrics. This article provides a step-by-step guide for creating an incident rule set to cater for the above scenario, that is, to create an incident and send a notification after the Agent Unreachable event has remained open for a five-minute duration. Steps to create the incident rule 1.     Log on to the console and navigate to Setup -> Incidents -> Incident Rules. Note: A non-super user requires the Create Enterprise Rule Set privilege, which is a resource privilege, to create an incident rule. The Incident Rules - All Enterprise Rules page displays. 2.     Click Create Rule Set … The Create Rule Set page displays. 3.     Enter a name for the rule set (e.g. Rule set for agents in flaky network areas), optionally enter a description, and leave everything else at default values, and click + Add. The Search and Select: Targets page pops up. Note:  While you can create a rule set for individual targets, it is a best practice to use a group for this purpose. 4.     Select an appropriate group, e.g. the AgentsInFlakyNework group. The Select button becomes enabled, click the button. The Create Rule Set page displays. 5.     Leave everything at default values, and click the Rules tab. The Create Rule Set page displays. 6.     Click Create… The Select Type of Rule to Create page pops up. 7.     Leave the Incoming events and updates to events option selected, and click Continue. The Create New Rule : Select Events page displays. 8.     Select Target Availability from the Type drop-down list. The page shows more options for Target Availability. 9.     Select the Specific events of type Target Availability option, and click + Add. The Select Target Availability events page pops up. 10.   Select Agent from the Target Type dropdown list. The page expands. 11.   Click the Agent unreachable checkbox, and click OK. Note: If you want to also receive a notification when the event is cleared, click the Agent unreachable end checkbox as well before clicking OK. The Create New Rule : Select Events page displays. 12.   Click Next. The Create New Rule : Add Actions page displays. 13.   Click + Add. The Add Actions page displays. 14.   Do the following: a.     Select the Only execute the actions if specified conditions match option (You don’t want the action to trigger always). The following options appear in the Conditions for Actions section. b.     Select the Event has been open for specified duration option. The Conditions for actions section expands. c.     Change the values of Event has been open for to 5 Minutes as shown below. d.     In the Create Incident or Update Incident section, click the Create Incident checkbox as following: e.     In the Notifications section, enter an appropriate EM user or email address in the E-mail To field. f.     Click Continue (in the top right hand corner). The Create New Rule : Add Actions page displays. 15.   Click Next. The Create New Rule : Specify name and Description page displays. 16.   Enter a rule name, and click Next. The Create New Rule : Review page appears. 17.   Click Continue, and proceed to save the rule set. The incident rule set creation completes. After one of the agents in the group specified in the rule set is stopped for over 5 minutes, EM will send a mail notification and create an incident as shown in the following screenshot. In conclusion, you have seen the steps to create an example incident rule set that only creates an incident and triggers a notification after an event has been open for a specified period. Such an incident rule can help prevent unnecessary incidents and alert notifications leaving EM administrators time to more important tasks. - Loc Nhan

    Read the article

  • Google Chrome Extensions: Launch Event (part 1)

    Google Chrome Extensions: Launch Event (part 1) Video Footage from the Google Chrome Extensions launch event on 12/09/09. In this part, Brian Rakowski, product management director, provides an update on Google Chrome and explains why extensions are important for the Google Chrome team. From: GoogleDevelopers Views: 5175 17 ratings Time: 04:39 More in Science & Technology

    Read the article

  • AutoCompleteTextView with custom list: how to set up onClick Listeners and getting the selected item

    - by steff
    Hi everyone, I am working on an app which uses tags. Accessing those should be as simple as possible. Working with an AutoCompleteTextView seems appropriate to me. What I want: existing tags should be displayed in a selectable list with a CheckBox on each item's side existing tags should be displayed UPON FOCUS of AutoCompleteTextView (i.e. not after typing a letter) What I've done so far is storing tags in a dedicated sqlite3 table. Tags are queried resulting in a Cursor. The Cursor is passed to a SimpleCursorAdapter which looks like this: Cursor cursor = dbHelper.getAllTags(); startManagingCursor(cursor); String[] columns = new String[] { TagsDB._TAG}; int[] to = new int[] { R.id.tv_tags}; SimpleCursorAdapter cursAdapt = new SimpleCursorAdapter(this, R.layout.tags_row, cursor, columns, to); actv.setAdapter(cursAdapt); As you can see I created *tags_row.xml* which looks like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="4dip" android:paddingRight="4dip" android:orientation="horizontal"> <TextView android:id="@+id/tv_tags" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#000" android:onClick="actv_item_click" /> <CheckBox android:id="@+id/cb_tags" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="actv_item_checked" /> </LinearLayout> It looks like this: So the results are displayed just as I'd want them to. But the TextView's onClick listener does not respond. And I don't have a clue on how to access the data once an item is (de-)selected. Behaviour of the list should be the following: tapping a CheckBox item should insert/append the corresponding tag into the AutoCompleteTextView (tags will be semicolon-seperated) tapping a TextView item should insert/apped the corresponding tag into the AutoCompleteTextView AND close the list. So please help me out. Thanks in advance, steff

    Read the article

  • Custom Tabcontrol in silverlight 4

    - by Archie
    Hello, I'm trying to design a tab control which will have a tabs on left hane hand side, and will have a text displayed vertically besides it. And will have the Page displayed in the main tab control. For reference you can visit : http://www.nseindia.com/ and click on any tab in the main menu. How can it be designed? I have created a style in App.xaml since it would be applicable to all tabs. But I'm not sure how to get the control's name in the page I would be using. Thanks.

    Read the article

  • Add a Session Variable or Custom field to the Elmah Error Log table

    - by VJ
    I want to add my own session variable to elmah error log table and display it. I already have modified the source code and added the new fields to Error.cs and other fields but I don't know but when I assign an HttpContext.Current.Session["MyVar"].tostring() value to my field in the constructor it stops logging exceptions and does not log any exception. I just need to get the value of the session variable is there other way for this. I read a post which he added fields for the email but it does not say where exactly should I get the session value.

    Read the article

  • Symfony 1.4: Custom error message for CSRF in forms

    - by Tom
    Hi, Can anyone tell me where/how to customise the CSRF token error message for forms in Symfony 1.4. I'm using sfDoctrineGuard for logins and in this form particularly, whenever a session runs out and you still have the page open, it throws a very user-unfriendly error: "CSRF attack detected". Something like "This session has expired. Please return to the home page and try again" sounds better. What's the right way to do this in the form class? Thanks.

    Read the article

  • How to add Custom View +Relative Layout into ViewGroup

    - by TimothyMiller
    Hi I am creating a View where you can draw on the screen, using a view, where I would like to have a button/titlebar drawn at the top of the screen. Here is my current code public class FingerPaint extends Activity implements ColorPickerDialog.OnColorChangedListener { private Paint mPaint; private MyView mView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout main = new LinearLayout(this); mView = new MyView(this); main.addView(this.getLayoutInflater().inflate( R.layout.topbar, null )); main.addView(mView); main.bringChildToFront(mView); setContentView(main); // mView.addView(this.getLayoutInflater().inflate( R.layout.topbar, null )); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(0xFFFF0000); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(12); mBitmaps=new Bitmap[100]; location=0; actualSize=0; mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 }, 0.4f, 6, 3.5f); mBlur = new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL); setContentView(main); } public class MyView extends View{ ......... } But when run, only the topbar.xml view is shown. I want the status bar from topbar and the rest down to be from the myView (for drawing on the screen like paint). Am I using ViewGroup properly?

    Read the article

  • Blackberry custom OVERLAY horizontal menu

    - by Dachmt
    Thanks to Max in this post, I made an horizontal menu. But now I'm trying to make an overlay menu, i I don't find how to do that... Let's see what i got first. So, I have a class MapScreen which display my map: public class MapScreen extends MenuScreen Then, I have in the same file the MenuScreen class like this that allows to display the horizontal menu when I press the MENU key: abstract class MenuScreen extends MainScreen { boolean mMenuEnabled = false; CyclicHFManager mMenuManager = null; public MenuScreen() { mMenuManager = new CyclicHFManager(); mMenuManager.setBorder(BorderFactory.createBevelBorder(new XYEdges(4, 0, 0, 0), new XYEdges(Color.DARKBLUE, 0, 0, 0), new XYEdges( Color.WHITE, 0, 0, 0))); mMenuManager.setBackground(BackgroundFactory .createLinearGradientBackground(Color.DARKBLUE, Color.DARKBLUE, Color.LIGHTBLUE, Color.LIGHTBLUE)); for (int i = 0; i < 10; i++) { Bitmap nBitmap = new Bitmap(60, 60); Graphics g = new Graphics(nBitmap); g.setColor(Color.DARKBLUE); g.fillRect(0, 0, 60, 60); g.setColor(Color.WHITE); g.drawRect(0, 0, 60, 60); Font f = g.getFont().derive(Font.BOLD, 40); g.setFont(f); String text = String.valueOf(i); g.drawText(text, (60 - f.getAdvance(text)) >> 1, (60 - f .getHeight()) >> 1); Bitmap fBitmap = new Bitmap(60, 60); g = new Graphics(fBitmap); g.setColor(Color.DARKBLUE); g.fillRect(0, 0, 60, 60); g.setColor(Color.GOLD); g.drawRect(0, 0, 60, 60); g.setFont(f); g.drawText(text, (60 - f.getAdvance(text)) >> 1, (60 - f .getHeight()) >> 1); BitmapButtonField button = new BitmapButtonField(nBitmap, fBitmap); button.setCookie(String.valueOf(i)); button.setPadding(new XYEdges(0, 18, 0, 18)); button.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { Dialog.inform("Button # " + (String) field.getCookie()); } }); mMenuManager.add(button); } } protected boolean keyDown(int keycode, int time) { if (Keypad.KEY_MENU == Keypad.key(keycode)) { if (mMenuManager.getManager() != null) { delete(mMenuManager); mMenuManager.mCyclicTurnedOn = false; } else { add(mMenuManager); mMenuManager.getField(2).setFocus(); mMenuManager.mCyclicTurnedOn = true; } return true; } else { return super.keyDown(keycode, time); } }} And finally my menu manager: public class CyclicHFManager extends HorizontalFieldManager { int mFocusedFieldIndex = 0; public boolean mCyclicTurnedOn = false; public void focusChangeNotify(int arg0) { super.focusChangeNotify(arg0); if (mCyclicTurnedOn) { int focusedFieldIndexNew = getFieldWithFocusIndex(); if (focusedFieldIndexNew != mFocusedFieldIndex) { if (focusedFieldIndexNew - mFocusedFieldIndex > 0) switchField(0, getFieldCount() - 1); else switchField(getFieldCount() - 1, 0); } } else { mFocusedFieldIndex = getFieldWithFocusIndex(); } } private void switchField(int prevIndex, int newIndex) { Field field = getField(prevIndex); delete(field); insert(field, newIndex); }} So as it is like this, it is working: when I press the MENU key, the menu appears, i can navigate between buttons, and it disappear when I press again the same key. The only problem is my menu isn't overlaying my map, it pushes the content up. I tried with the menu manager like in your first response, resizing the content manager but it is the same result. Max gave me the link http://stackoverflow.com/questions/1497073/blackberry-fields-layout-animation to do so, but I really don't know how to use it to make it work in my project... Thank you for your help! UPDATE This works great, it's what I wanted. However, I still have a problem because I'm under 4.5. So first in the MenuHostManager constructor, I deleted the USE_ALL_HEIGHT and change setPositionChild(mMenuManager, 0, Display.getHeight() - mMenuManager.getPreferredHeight()); like this to have the menu at the bottom of the screen. It worked. Then, instead of drawing my bitmaps, I did this: Bitmap nBitmap = EncodedImage.getEncodedImageResource("menu" + i + ".png").getBitmap(); BitmapButtonField button = new BitmapButtonField(nBitmap, nBitmap); And it worked too (no rollover for now, later). So it is great! I also overwrite the Paint method of my CyclicHFManager to have a background color, because I can't use the BorderFactory and BackgroundFactory... My menu bar has a color for now so it's ok. Then, because of these 2 classes missing, in my BitmapButtonField I had to delete the 2 setBorder functions that change the borders. And now i have my buttons pretty big like normal buttons with borders... How can I make the same effect as the setBorder functions under 4.5? (BTW, setBorder is not working under 4.5 too...). Thank you!

    Read the article

  • Android Custom Dialog NullPointerException

    - by Kyle Hughes
    I cannot for the life of me figure out why I'm getting a NullPointerException. When a user clicks on a particular image, a dialog window is supposed to pop-up and display a larger version of said image: private OnClickListener coverListener = new OnClickListener() { public void onClick(View v) { showDialog(DIALOG_COVER); } }; DIALOG_COVER is set to = 0. The associated onCreateDialog looks like this: protected Dialog onCreateDialog(int id) { Dialog dialog; switch(id) { case DIALOG_COVER: dialog = new Dialog(mContext); dialog.setContentView(R.layout.cover_dialog); dialog.setTitle(book.getTitle()); ImageView coverLarge = (ImageView)findViewById(R.id.coverLarge); coverLarge.setImageBitmap(book.getCover()); break; default: dialog = null; } return dialog; } For reference, this is cover_dialog.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/coverDialog" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp"> <ImageView android:id="@+id/coverLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="fitStart" /></LinearLayout> Now, when the image previously described is clicked, the application immediately crashes and throws the following error through LogCat: 06-08 13:29:17.727: ERROR/AndroidRuntime(2220): Uncaught handler: thread main exiting due to uncaught exception 06-08 13:29:17.757: ERROR/AndroidRuntime(2220): java.lang.NullPointerException 06-08 13:29:17.757: ERROR/AndroidRuntime(2220): at org.kylehughes.android.brarian.AndroidBrarian.onCreateDialog(AndroidBrarian.java:259) The line in question refers to this line inside of onCreateDialog: coverLarge.setImageBitmap(book.getCover()); Basically, I don't get why coverLarge is null at that point. Any help would be much appreciated.

    Read the article

  • Weird y offset when using custom frag shader (Cocos2d-x)

    - by Mister Guacamole
    I'm trying to mask a sprite so I wrote a simple fragment shader that renders only the pixels that are not hidden under another texture (the mask). The problem is that it seems my texture has its y-coordinate offset after passing through the shader. This is the init method of the sprite (GroundZone) I want to mask: bool GroundZone::initWithSize(Size size) { // [...] // Setup the mask of the sprite m_mask = RenderTexture::create(textureWidth, textureHeight); m_mask->retain(); m_mask->setKeepMatrix(true); Texture2D *maskTexture = m_mask->getSprite()->getTexture(); maskTexture->setAliasTexParameters(); // Disable linear interpolation on the mask // Load the custom frag shader with a default vert shader as the sprite’s program FileUtils *fileUtils = FileUtils::getInstance(); string vertexSource = ccPositionTextureA8Color_vert; string fragmentSource = fileUtils->getStringFromFile( fileUtils->fullPathForFilename("CustomShader_AlphaMask_frag.fsh")); GLProgram *shader = new GLProgram; shader->initWithByteArrays(vertexSource.c_str(), fragmentSource.c_str()); shader->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION); shader->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORDS); shader->link(); CHECK_GL_ERROR_DEBUG(); shader->updateUniforms(); CHECK_GL_ERROR_DEBUG(); int maskTexUniformLoc = shader->getUniformLocationForName("u_alphaMaskTexture"); shader->setUniformLocationWith1i(maskTexUniformLoc, 1); this->setShaderProgram(shader); shader->release(); // [...] } These are the custom drawing methods for actually drawing the mask over the sprite: You need to know that m_mask is modified externally by another class, the onDraw() method only render it. void GroundZone::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) { m_renderCommand.init(_globalZOrder); m_renderCommand.func = CC_CALLBACK_0(GroundZone::onDraw, this, transform, transformUpdated); renderer->addCommand(&m_renderCommand); Sprite::draw(renderer, transform, transformUpdated); } void GroundZone::onDraw(const kmMat4 &transform, bool transformUpdated) { GLProgram *shader = this->getShaderProgram(); shader->use(); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, m_mask->getSprite()->getTexture()->getName()); glActiveTexture(GL_TEXTURE0); } Below is the method (located in another class, GroundLayer) that modify the mask by drawing a line from point start to point end. Both points are in Cocos2d coordinates (Point (0,0) is down-left). void GroundLayer::drawTunnel(Point start, Point end) { // To dig a line, we need first to get the texture of the zone we will be digging into. Then we get the // relative position of the start and end point in the zone's node space. Finally we use the custom shader to // draw a mask over the existing texture. for (auto it = _children.begin(); it != _children.end(); it++) { GroundZone *zone = static_cast<GroundZone *>(*it); Point nodeStart = zone->convertToNodeSpace(start); Point nodeEnd = zone->convertToNodeSpace(end); // Now that we have our two points converted to node space, it's easy to draw a mask that contains a line // going from the start point to the end point and that is then applied over the current texture. Size groundZoneSize = zone->getContentSize(); RenderTexture *rt = zone->getMask(); rt->begin(); { // Draw a line going from start and going to end in the texture, the line will act as a mask over the // existing texture DrawNode *line = DrawNode::create(); line->retain(); line->drawSegment(nodeStart, nodeEnd, 20, Color4F::RED); line->visit(); } rt->end(); } } Finally, here's the custom shader I wrote. #ifdef GL_ES precision mediump float; #endif varying vec2 v_texCoord; uniform sampler2D u_texture; uniform sampler2D u_alphaMaskTexture; void main() { float maskAlpha = texture2D(u_alphaMaskTexture, v_texCoord).a; float texAlpha = texture2D(u_texture, v_texCoord).a; float blendAlpha = (1.0 - maskAlpha) * texAlpha; // Show only where mask is invisible vec3 texColor = texture2D(u_texture, v_texCoord).rgb; gl_FragColor = vec4(texColor, blendAlpha); return; } I got a problem with the y coordinates. Indeed, it seems that once it has passed through my custom shader, the sprite's texture is not at the right place: Without custom shader (the sprite is the brown thing): With custom shader: What's going on here? Thanks :) EDIT It looks like after passing through the shader when I set the position of the sprite I set it in points, with (0,0) being in the top-right. Indeed, when I do sprite->setPosition(320, 480), the sprite is perfectly placed at the top of the screen.

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >