Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.59 KB | None | 0 0
  1. // Creating the menu items and sections
  2. void set_up_menu_stuff() {
  3.     int i;
  4.     for(i=0; i < (int)sizeof(menu_items)/ (int)sizeof(menu_items[0]); i++) {
  5.         menu_items[i] = (SimpleMenuItem) {
  6.             .title = menu_options[i],
  7.             .callback = simple_menu_callback(i) /* I believe this is a part of the problem here */
  8.             };
  9.     switch(i) {
  10.         case 0:
  11.             menu_items[i].subtitle = "Add an alarm clock";
  12.             break;
  13.         case 1:
  14.             menu_items[i].subtitle = "Edit an alarm clock";
  15.             break;
  16.         case 2:
  17.             menu_items[i].subtitle = "Delete an alarm clock";
  18.             break;
  19.             };
  20.     };
  21.     menu_sections[0] = (SimpleMenuSection) {
  22.         .title = "Options",
  23.         .items = menu_items,
  24.         .num_items = 3
  25.     };
  26. }
  27.  
  28.  
  29. void simple_menu_callback_function(int option) {
  30.     // Option is supposed to be the index number passed through based on which menu item is clicked
  31.     window = window_create();
  32.     if(option == 0) {
  33.         text_layer = text_layer_create(layer_get_frame(window_dimensions));
  34.         text_layer_set_text(text_layer,"Filler for adding an alarm clock!");
  35.     } else if(option == 1) {
  36.         text_layer = text_layer_create(layer_get_frame(window_dimensions));
  37.         text_layer_set_text(text_layer,"Filler for editing an alarm clock!");
  38.     } else if(option == 2) {
  39.         text_layer = text_layer_create(layer_get_frame(window_dimensions));
  40.         text_layer_set_text(text_layer,"Filler for deleting an alarm clock!");
  41.     } else {
  42.         printf("Something went wrong trying to send option data to deeper callback function\n");
  43.     }
  44.     layer_add_child(window_get_root_layer(window),(Layer*)text_layer);
  45. }
  46.  
  47. /* The error I get is:
  48. error: void value not ignored as it ought to be */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement