Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Black stripe with menus on Windows

Credits go to alex glez and SiegeLord for helping out!
This thread is locked; no one can reply to it. rss feed Print
Black stripe with menus on Windows
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

alex glez
Member #16,757
October 2017

Hi Edgar, thank you. Surely I've made a mistake and I don't see where it is, thanks.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

alex, I can't get your code to compile. It keeps saying narrowing conversions from -1 to uint16_t and I don't know what's wrong with it.

Can you provide a working example?

EDIT
I'm trying to debug something now. ALLEGRO_MENU_SEPARATOR doesn't work out of the box. That's where the -1 to uint16_t conversions come from.

I'm debugging menu creation. It's not working right yet.

alex glez
Member #16,757
October 2017

Hi Edgar. It works correctly for me, but it expands the window below with a strip of the same thickness as the menu, that is, a thick line at the end of the window, except for that problem, everything works correctly. The program has more than 12,000 lines of c++ code, I only put the part where the menu was defined and executed. Anyway, I am attaching an example.

If I remove... " al_set_display_menu(window, menu); "
fringe not shown.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

alex glez
Member #16,757
October 2017

Thanks, I use windows 11 and visual studio (c++).
I have not tried it on another operating system, although with "al_clear_to_color" I can change the color of the strip that it adds to the window and it is not very noticeable to the eye.

SiegeLord
Member #7,827
October 2006
avatar

I get the stripe too if I don't draw to the display, but if I draw, there's no stripe. Here's the code I used to test:

#SelectExpand
1#include "allegro5/allegro.h" 2#include "allegro5/allegro_native_dialog.h" 3 4int main(int argc , char** argv) { 5 6 (void)argc; 7 (void)argv; 8 9 ALLEGRO_MENU_INFO main_menu_info[] = 10 { 11 ALLEGRO_START_OF_MENU("&Archivo", 100), 12 { "&Cargar Capas", 101, 0, NULL }, 13 { "&Cargar Elementos", 102, 0, NULL }, 14 {NULL , (uint16_t)-1 , 0 , NULL}, 15 { "&Salir", 103, 0, NULL }, 16 ALLEGRO_END_OF_MENU, 17 18 ALLEGRO_START_OF_MENU("&Configuracion", 200), 19 ALLEGRO_START_OF_MENU("&Velocidad de desplazamiento del raton", 201), 20 { "01", 20101, 0, NULL }, 21 { "02", 20102, 0, NULL }, 22 { "03", 20103, 0, NULL }, 23 { "04", 20104, 0, NULL }, 24 { "05", 20105, 0, NULL }, 25 { "06", 20106, 0, NULL }, 26 { "07", 20107, 0, NULL }, 27 { "08", 20108, 0, NULL }, 28 { "09", 20109, 0, NULL }, 29 { "10", 20110, 0, NULL }, 30 { "11", 20111, 0, NULL }, 31 { "12", 20112, 0, NULL }, 32 { "13", 20113, 0, NULL }, 33 { "14", 20114, 0, NULL }, 34 { "15", 20115, 0, NULL }, 35 { "16", 20116, 0, NULL }, 36 { "17", 20117, 0, NULL }, 37 { "18", 20118, 0, NULL }, 38 { "19", 20119, 0, NULL }, 39 { "20", 20120, 0, NULL }, 40 ALLEGRO_END_OF_MENU, 41 42 ALLEGRO_START_OF_MENU("&Velocidad de zoom del raton", 202), 43 { "01", 20201, 0, NULL }, 44 { "02", 20202, 0, NULL }, 45 { "03", 20203, 0, NULL }, 46 { "04", 20204, 0, NULL }, 47 { "05", 20205, 0, NULL }, 48 { "06", 20206, 0, NULL }, 49 { "07", 20207, 0, NULL }, 50 { "08", 20208, 0, NULL }, 51 { "09", 20209, 0, NULL }, 52 { "10", 20210, 0, NULL }, 53 ALLEGRO_END_OF_MENU, 54 55 { "&Mostrar datos de la foto", 203, ALLEGRO_MENU_ITEM_CHECKBOX, NULL }, 56 ALLEGRO_START_OF_MENU("&Teclado Numerico", 204), 57 { "Administrador", 20401, 0, NULL }, 58 { "Usuario 01", 20402, ALLEGRO_MENU_ITEM_DISABLED, NULL }, 59 { "Usuario 02", 20403, ALLEGRO_MENU_ITEM_DISABLED, NULL }, 60 ALLEGRO_END_OF_MENU, 61 62 ALLEGRO_START_OF_MENU("&Tiempo de demora al pasar pagina", 205), 63 { "1.0", 20501, 0, NULL }, 64 { "1.5", 20502, 0, NULL }, 65 { "2.0", 20503, 0, NULL }, 66 ALLEGRO_END_OF_MENU, 67 68 { "&Exportar a la vez que procesa las fotos", 206, ALLEGRO_MENU_ITEM_DISABLED, NULL }, 69 70 {NULL , (uint16_t)-1 , 0 , NULL}, 71 { "&Administrador", 207, ALLEGRO_MENU_ITEM_DISABLED, NULL }, 72 ALLEGRO_END_OF_MENU, 73 ALLEGRO_START_OF_MENU("&Nemesis", 300), 74 { "&Iniciar", 301, 0, NULL }, 75 ALLEGRO_END_OF_MENU, 76 77 ALLEGRO_START_OF_MENU("&Ayuda", 400), 78 { "&Acerca de Nemesis", 401, 0, NULL }, 79 ALLEGRO_END_OF_MENU, 80 ALLEGRO_END_OF_MENU 81 82 }; 83 84 85 al_init(); 86 ALLEGRO_DISPLAY* display = al_create_display(800,600); 87 88 al_init_native_dialog_addon(); 89 90 ALLEGRO_MENU* menu = al_build_menu(main_menu_info); 91 92 al_set_display_menu(display, menu); 93 94 ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); 95 96 al_register_event_source(queue , al_get_display_event_source(display)); 97 98 while(true) { 99 ALLEGRO_EVENT e; 100 if (al_get_next_event(queue , &e)) { 101 if (e.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { 102 break; 103 } 104 } 105 al_rest(0.1); 106 al_clear_to_color(al_map_rgb_f(0.2, 0.2, 0.)); 107 al_flip_display(); 108 }; 109 110 return 0; 111}

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

alex glez
Member #16,757
October 2017

Ok, thanks guys, in the end we will have to draw as you comment to cover the strip, notice that when you put "al_set_display_menu(window, menu);" the window grows at the top to include the menu and also at the bottom (the black strip below the line in the photo that does not disappear). It's really just a cosmetic issue. Thank you very much

Go to: