Hi guys,
I need your help.. as you may know I am learning to develop programs on amiga os.. Honestly it is a bit frustating because it is not easy to find some updated example (the examples inside sdk use old reaction macros that are deprecated) and some kind of basic tutorial that teach you the basic operations and I am talking about the gui (that imho is the hardest part),.. by the way, sorry for the outburst, now the question:
I am creating a very small program and, so far, I am able to create the object window, attach buttons, use the BVS_GROUP to create box separation area for buttons and so it is ok..
As I am proceding step by step, now I am trying to insert a listbrowser gadget and here I have some problem... First of all I do not know where to start, I use this line of reasoning: I create the object window and everything that is inside my window is an object and so the listbrowser gadget too.
About the list browser gadget, I create a new object inside my window, the object is inside my enum, inside my newobject i have the taglist with the pair attribute/value and i think it is ok.
Rightnow I just want to have my window and an empty listbrowser gadget. Then, if I understand well, I have to attach a node to the listbrowser gadget and then populate it with datas.. is it right?
So, here my code and then the error I got when I try to compile it.. :
/****************************************************************/ /* WINDOW OBJECT */ /* */ /* PER COMPILARE: */ /* */ /* gcc -o winobj winobj.c */ /* */ /****************************************************************/ // INCLUDO LIBRERIA BASE #include <proto/intuition.h> #include <proto/exec.h> #include <proto/dos.h> // INCLUDE CLASSI BOOPSI PER WINDOW OBJECT #include <classes/window.h> #include <gadgets/button.h> #include <gadgets/layout.h> #include <gadgets/listbrowser.h> // DICHIARO LE LIBRARY BASE O LE CLASS LIBRARY BASE // DELLA WINDOW CLASS, BUTTON CLASS, LAYOUT CLASS // E INTUITION. // LA DOS LIBRARY E LA EXEC LIBRARY SONO AUTOMOATICAMENTE APERTE! struct ClassLibrary *WindowBase, *LayoutBase, *ButtonBase, *ListBrowserBase = NULL; struct Library *IntuitionBase = NULL; // DICHIARO LE INTERFACES POINTER E LE CLASS POINTER // DELLE LIBRERIE E DELLE CLASSI struct IntuitionIFace *IIntuition = NULL; struct ListBrowserIFace *IListBrowser = NULL; Class *WindowClass, *LayoutClass, *ButtonClass, *ListBrowserClass = NULL; // DICHIARO ENUMERAZIONE PER TUTTI I MIEI OGGETTI enum{ OID_WINDOW, OID_LAYOUT_1, OID_LBS_GDG_1, OID_LAST }; // DICHIARO UN PUNTATORE DI ARRAY DI TIPO OBJECT Object *object[OID_LAST]; //DICHIARO STRUCT LIST E COLUMN INFO PER LISTBROWSER struct ColumnInfo ci[] = { { 80, "Col 1", 0 }, { 60, "Col 2", 0 }, { 60, "Col 3", 0 }, { -1, (STRPTR)~0, -1 } }; struct List label_list; // DICHIARO FUNZIONE PER CHIUDERE LE LIBRERIE E INTERFACCE APERTE static void Nube_CloseLibraries(void){ if(IListBrowser != NULL){ IExec->DropInterface((struct Interface *)IListBrowser); } if(ListBrowserBase != NULL){ IIntuition->CloseClass(ListBrowserBase); } if(ButtonBase != NULL){ IIntuition->CloseClass(ButtonBase); } if(LayoutBase != NULL){ IIntuition->CloseClass(LayoutBase); } if(WindowBase != NULL){ IIntuition->CloseClass(WindowBase); } if(IIntuition != NULL){ IExec->DropInterface((struct Interface *)IIntuition); } if(IntuitionBase != NULL){ IExec->CloseLibrary(IntuitionBase); } if(IDOS != NULL){ IExec->DropInterface((struct Interface *)IDOS); } if(DOSBase){ IExec->CloseLibrary((struct Library *)DOSBase); } } // DICHIARO LO STACK MINIMO RICHIESTO PER IL MIO PROGRAMMA static const char USED minstack[]="$STACK:80000"; int main(){ // APRO INTUITION LIBRARY IntuitionBase = IExec->OpenLibrary("intuition.library", 52); IIntuition = (struct IntuitionIFace *)IExec->GetInterface(IntuitionBase, "main", 1, NULL); if(IIntuition == NULL){ IDOS->Printf("Impossibile aprire la libreria\n"); }else{ IDOS->Printf("Libreria aperta correttamente\n"); } // APRO WINDOW CLASS WindowBase = (struct ClassLibrary *)IIntuition->OpenClass("window.class", 52, &WindowClass); if(WindowBase = NULL){ IDOS->Printf("impossibile aprire la classe\n"); }else{ IDOS->Printf("classe libreria aperta correttamente\n"); } // APRO LAYOUT CLASS LayoutBase = (struct ClassLibrary *)IIntuition->OpenClass("gadgets/layout.gadget", 52, &LayoutClass); if(LayoutBase == NULL){ IDOS->Printf("impossibile aprire la classe\n"); }else{ IDOS->Printf("classe aperta correttamente\n"); } // APRO BUTTON GADGET ButtonBase = (struct ClassLibrary *)IIntuition->OpenClass("gadgets/button.gadget", 52, &ButtonClass); if(ButtonBase == NULL){ IDOS->Printf("impossibile aprire la classe\n"); }else{ IDOS->Printf("classe aperta correttamente\n"); } // APRO LISTBROWSER CLASS ListBrowserBase = (struct ClassLibrary *)IIntuition->OpenClass("gadgets/listbrowser.gadget", 52, &ListBrowserClass); if(ListBrowserBase == NULL){ IDOS->Printf("impossibile aprire la classe\n"); }else{ IDOS->Printf("classe aperta correttamente\n"); } IListBrowser = (struct ListBrowserIFace *)IExec->GetInterface((struct Library*)ListBrowserBase, "main", 1, NULL); if(ListBrowserBase == NULL){ IDOS->Printf("impossibile ottenere l'interfaccia\n"); }else{ IDOS->Printf("interfaccia ottenuta correttamente\n"); } object[OID_WINDOW] = IIntuition->NewObject(WindowClass, NULL, WA_Title, "BOOPSI", WA_Width, 800, WA_Height, 600, WA_DragBar, TRUE, WA_CloseGadget, TRUE, WA_SizeGadget, TRUE, WA_DepthGadget, TRUE, WA_Activate, TRUE, WINDOW_IconifyGadget, TRUE, WINDOW_Position, WPOS_CENTERSCREEN, WA_NewLookMenus, TRUE, WA_AutoAdjust, TRUE, WA_InnerWidth, 400, WA_InnerHeight, 400, WINDOW_Layout, object[OID_LAYOUT_1] = IIntuition->NewObject(LayoutClass, NULL, LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ, LAYOUT_SpaceOuter, TRUE, LAYOUT_DeferLayout, TRUE, LAYOUT_AddChild, object[OID_LBS_GDG_1] = IIntuition->NewObject(ListBrowserClass, NULL, GA_ID, OID_LBS_GDG_1, GA_Top, 10, GA_Left, 10, GA_RelWidth, -34, GA_RelHeight, -30, GA_RelVerify, TRUE, LISTBROWSER_Labels, label_list, LISTBROWSER_ColumnInfo, ci, LISTBROWSER_ColumnTitles, TRUE, LISTBROWSER_MultiSelect, FALSE, LISTBROWSER_Separators, TRUE, LISTBROWSER_ShowSelected, FALSE, LISTBROWSER_Editable, TRUE, TAG_END) // FINE LISTBROWSER_1 TAG_END), // FINE LAYOUT_1 TAG_END); // FINE LAYOUT FINESTRA IIntuition->IDoMethod(object[OID_WINDOW], WM_OPEN, NULL); IDOS->Delay(400); IIntuition->IDoMethod(object[OID_WINDOW], WM_CLOSE); IIntuition->DisposeObject(object[OID_WINDOW]); Nube_CloseLibraries(); return (0); }
here the error from gcc:
winobj.c: In function 'main':
winobj.c:197: error: called object 'IIntuition->NewObject(&*IIntuition, ListBrowserClass, 0u, 2147680272ul, 2, 2147680259ul, 10, 2147680257ul, 10, 2147680262ul, -0x00000000000000022, 2147680264ul, -0x0000000000000001e, 2147680278ul, 1, 2231382019ul, label_list, 2231382024ul, & ci, 2231382033ul, 1, 2231382022ul, 0, 2231382023ul, 1, 2231382034ul, 0, 2231382049ul, 1, 0ul)' is not a function
Why the gcc tells me that NewObject is not a function??
Looks like you are missing a comma at the end of line 196...
Simon
thanks, you saved my day, I looked into code so many times....
I really appreciate it,
Davide