18.02.2013 Views

NCURSES ile Yazılım Geli¸stirme NASIL

NCURSES ile Yazılım Geli¸stirme NASIL

NCURSES ile Yazılım Geli¸stirme NASIL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

}<br />

<strong>NCURSES</strong> <strong>ile</strong> Yazılım Geli¸stirme <strong>NASIL</strong><br />

move(20, 0);<br />

clrtoeol();<br />

mvprintw(20, 0, "Seç<strong>ile</strong>n ö˘ge : %s",<br />

item_name(current_item(my_menu)));<br />

pos_menu_cursor(my_menu);<br />

break;<br />

}<br />

unpost_menu(my_menu);<br />

for(i = 0; i < n_choices; ++i)<br />

free_item(my_items[i]);<br />

free_menu(my_menu);<br />

endwin();<br />

17.9. Faydalı Kullanıcı Göstericisi<br />

Menüdeki her ö˘geye bir kullanıcı göstericisi atayabiliriz. Panellerdeki kullanıcı göstericisi <strong>ile</strong> aynı ¸sekilde<br />

çalı¸smaktadır. Menü sistemi tarafından kullanılmazlar. Bunlar içerisine istedi˘giniz herhangi bir ¸seyi koyabilirsiniz.<br />

Ben genelde menü seçene˘gi seçildi˘ginde çalı¸sacak i¸slevi (seç<strong>ile</strong>n ve muhtemelen kullanıcının ’ladı˘gı)<br />

tutmak için kullanırım.<br />

Örnek 24. Menü Kullanıcı Gösteric<strong>ile</strong>rinin Kullanımı<br />

#include <br />

#include <br />

#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))<br />

#define CTRLD 4<br />

char *choices[] = {<br />

"Choice 1",<br />

"Choice 2",<br />

"Choice 3",<br />

"Choice 4",<br />

"Choice 5",<br />

"Choice 6",<br />

"Choice 7",<br />

"Exit",<br />

};<br />

void func(char *name);<br />

int main()<br />

{ ITEM **my_items;<br />

int c;<br />

MENU *my_menu;<br />

int n_choices, i;<br />

ITEM *cur_item;<br />

/* Curses Kipi ˙Ilklendir */<br />

initscr();<br />

start_color();<br />

cbreak();<br />

noecho();<br />

keypad(stdscr, TRUE);<br />

init_pair(1, COLOR_RED, COLOR_BLACK);<br />

http://belgeler.org Linux Kitaplı˘gı 65 / 90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!