1 registered members (TipmyPip),
679
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: LBGUI - RELEASE
[Re: Espér]
#396645
03/08/12 20:02
03/08/12 20:02
|
Joined: Mar 2012
Posts: 3
helloMoto
Guest
|
Guest
Joined: Mar 2012
Posts: 3
|
Hello! I have a problem, i'm trying to use a combobox and get the result selected. I'm looking for a example in internet and in the forum. Please, I need help.
void comboClick()
{
LBG_LISTITEM* item;
if(comboboxForeign->chosen_option!=NULL)
{
printf(comboboxForeign->chosen_option->caption);
}
else printf("No selected");
}
...
comboboxForeign = LBG_create_combobox(window_menu,30, 110, 256, 16, 4, "Select the language", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), 16, 16, 224, &listbox_bmaps, LBG_bbmaps(combobox_button1_tga,combobox_button2_tga,combobox_button3_tga,combobox_button1_tga,combobox_button2_tga,combobox_button1_tga), CBF_SHOW);
LBG_create_listitem (comboboxForeign->menu, 100, strSpanish, 0);
LBG_create_listitem (comboboxForeign->menu, 100, strEnglish, 0);
LBG_create_listitem (comboboxForeign->menu, 100, strChinese, 0);
comboboxForeign->Open=comboClick;
comboboxForeign->Close=comboClick;
comboboxForeign->Destroy=comboClick;
The problem is that when i close, the printf don't show the correct selected item text, only show rubish. I looked the manual but i didn't see nothing about. Please, help. Thanks a lot!
|
|
|
Re: LBGUI - RELEASE
[Re: helloMoto]
#396647
03/08/12 20:10
03/08/12 20:10
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
Expert
|
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
that´s cause you just need comboboxForeign->caption The combobox is an editobox object, so it handles the caption string of the chosen item by itself ^^ Little Question to Lukas: Any chance to get file/object trees? I don´t need folder support, but file/subfile/sub-subfile support would be great ^^
|
|
|
Re: LBGUI - RELEASE
[Re: Espér]
#396649
03/08/12 20:20
03/08/12 20:20
|
Joined: May 2007
Posts: 2,043 Germany
Lukas
OP
Programmer
|
OP
Programmer
Joined: May 2007
Posts: 2,043
Germany
|
Little Question to Lukas: Any chance to get file/object trees? I don´t need folder support, but file/subfile/sub-subfile support would be great ^^ Maybe, but don't count on it. Especially not for the near future. I'm pretty certain I'm going to release an update this year, but it won't contain trees yet. Things like multiline textboxes are more important.
|
|
|
Re: LBGUI - RELEASE
[Re: Espér]
#396657
03/08/12 20:54
03/08/12 20:54
|
Joined: Mar 2012
Posts: 3
helloMoto
Guest
|
Guest
Joined: Mar 2012
Posts: 3
|
that´s cause you just need comboboxForeign->caption
The combobox is an editobox object, so it handles the caption string of the chosen item by itself ^^
Thanks, Espér. But I have the same problem. The printf show me the text: q[] It's so wrong.
void comboClick()
{
if(comboboxForeign->chosen_option!=NULL)
{
printf(comboboxForeign->caption);
printf((comboboxForeign->editbox->text.pstring)[0]);
printf(comboboxForeign->editbox->caption);
(pruebas_txt.pstring)[0]=comboboxForeign->caption;
}
else printf("No selected");
}
¿Any ideas? If anybody knows some example of this, i will looked. Thanks brothers!
|
|
|
Re: LBGUI - RELEASE
[Re: helloMoto]
#396658
03/08/12 20:59
03/08/12 20:59
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
Expert
|
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
when i look at the code.. Did you say the combobox to use a Select script? i did it this way:
LBG_COMBOBOX* combobox1 = 0;
void combobox_clicked()
{
wait(1);
//object_category_string
str_cpy(object_category_string, combobox1->caption);
call_kategorie(-kategorie);
if(edit_property_text_open == 1)
{
empty_texture_list();
change_texture_list(wich_skinnumber);
}
}
STRING* combobox_category = "";
void call_file_category()
{
var ysize = screen_size.y-(bmap_height(bmedit_gui_top)+(bmap_height(bmedit_gui_bottom)+128));
var xsize = bmap_width(bmedit_gui_lm)-6;
var yposition = bmap_height(bmedit_gui_top)+128;
combobox1 = LBG_create_combobox(0, 0, yposition, xsize, 4, 4, "1 - Vatikan", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), 4, 4, xsize-4, &listbox_bmaps, LBG_bbmaps(combobox_button1_tga,combobox_button2_tga,combobox_button3_tga,combobox_button1_tga,combobox_button2_tga,combobox_button1_tga), CBF_SHOW);
combobox1->menu->layer = 2010;
combobox1->editbox->layer = 2010;
combobox1->button->layer = 2010;
combobox1->layer = 2010;
combobox1->menu->font = list_font;
combobox1->menu->itemheight = 20;
combobox1->menu->bmaps_over.bmap_left = listitem_over_left_tga;
combobox1->menu->bmaps_over.bmap_middle = listitem_over_middle_tga;
combobox1->menu->bmaps_over.bmap_right = listitem_over_right_tga;
combobox1->menu->bmaps_marked.bmap_left = listitem_marked_left_tga;
combobox1->menu->bmaps_marked.bmap_middle = listitem_marked_middle_tga;
combobox1->menu->bmaps_marked.bmap_right = listitem_marked_right_tga;
var fhandle;
fhandle= file_open_read("kdata.nfg");
while(1)
{
file_str_read(fhandle, combobox_category);
if(str_cmpi(combobox_category, "ENDE") == 0)
{LBG_create_listitem(combobox1->menu, 100, combobox_category, 0);}
else
{break;}
wait(1);
}
file_close(fhandle);
vec_set(combobox1->menu->color_default,vector(1,1,1));
vec_set(combobox1->menu->color_over,vector(255,1,1));
vec_set(combobox1->menu->color_marked,vector(1,1,1));
LBG_editbox_set_text_color(combobox1->editbox,vector(1,1,1));
combobox1->menu->Select=combobox_clicked; //giving each listitem the select function
LBG_update_combobox(combobox1);
}
And it´s working
|
|
|
Re: LBGUI - RELEASE
[Re: Espér]
#396699
03/09/12 08:36
03/09/12 08:36
|
Joined: Mar 2012
Posts: 3
helloMoto
Guest
|
Guest
Joined: Mar 2012
Posts: 3
|
Thank you for your attention!! I'm a beginner: Printf has a char* parameter not a *STRING parameter. Thanks a lot!
|
|
|
Re: LBGUI - RELEASE
[Re: Lukas]
#397903
03/25/12 03:04
03/25/12 03:04
|
Malice
Unregistered
|
Malice
Unregistered
|
EDIT*** Nevermind I got it. These doc and examples are not newbie friendly. Maybe one day I'll be a pro like most of you.
I'm a newbie so I'm sure this will be a newbie question. I have LBG_windows that are created at runtime randomly. Their pointers are local to the function, they are suposed to be destory when the 'OK' button is click, but from what I can tell in the manual the parent windows pointer is not passed to the button event function. If only one window was on screen then I could set the window pointer to a globel pointer at time of creaation and use that in the button event function. But I have many windows open at once. How do I pass the pointer of the parent window to the button event function???
Thanks Malice
Last edited by Malice; 03/25/12 03:36.
|
|
|
Re: LBGUI - RELEASE
[Re: ]
#400123
04/26/12 08:08
04/26/12 08:08
|
Joined: Apr 2005
Posts: 796 U.S.A. Michigan
exile
User
|
User
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
|
-Please remove post
Last edited by exile; 04/27/12 10:07.
|
|
|
Re: LBGUI - RELEASE
[Re: exile]
#417355
02/11/13 21:15
02/11/13 21:15
|
Joined: Nov 2007
Posts: 318 Brasil, Paraná
NeoNeper
Senior Member
|
Senior Member
Joined: Nov 2007
Posts: 318
Brasil, Paraná
|
First I like of the say that is really good LBGUI. TANKS Lukas. I want to take this opportunity to ask for help to solve a problem I'm not able to solve alone!.
How could I do for my (Vertical Scrolling), of the my LISTBOX, roll yourself Whenever I add a new ITEM on the list?
Please! Use easy words to be translated. because my English is not very good! Grateful. _______________________________________________________
|
|
|
|