ListBrowser Gadget error..

3 posts / 0 new
Last post
Nube
Nube's picture
Offline
Last seen: 5 years 6 months ago
Joined: 2012-09-10 02:09
ListBrowser Gadget error..

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.. :

  1. /****************************************************************/
  2. /* WINDOW OBJECT */
  3. /* */
  4. /* PER COMPILARE: */
  5. /* */
  6. /* gcc -o winobj winobj.c */
  7. /* */
  8. /****************************************************************/
  9.  
  10.  
  11. // INCLUDO LIBRERIA BASE
  12.  
  13. #include <proto/intuition.h>
  14. #include <proto/exec.h>
  15. #include <proto/dos.h>
  16.  
  17. // INCLUDE CLASSI BOOPSI PER WINDOW OBJECT
  18.  
  19. #include <classes/window.h>
  20. #include <gadgets/button.h>
  21. #include <gadgets/layout.h>
  22. #include <gadgets/listbrowser.h>
  23.  
  24. // DICHIARO LE LIBRARY BASE O LE CLASS LIBRARY BASE
  25. // DELLA WINDOW CLASS, BUTTON CLASS, LAYOUT CLASS
  26. // E INTUITION.
  27. // LA DOS LIBRARY E LA EXEC LIBRARY SONO AUTOMOATICAMENTE APERTE!
  28.  
  29.  
  30. struct ClassLibrary *WindowBase, *LayoutBase, *ButtonBase, *ListBrowserBase = NULL;
  31. struct Library *IntuitionBase = NULL;
  32.  
  33. // DICHIARO LE INTERFACES POINTER E LE CLASS POINTER
  34. // DELLE LIBRERIE E DELLE CLASSI
  35.  
  36. struct IntuitionIFace *IIntuition = NULL;
  37. struct ListBrowserIFace *IListBrowser = NULL;
  38.  
  39. Class *WindowClass, *LayoutClass, *ButtonClass, *ListBrowserClass = NULL;
  40.  
  41.  
  42. // DICHIARO ENUMERAZIONE PER TUTTI I MIEI OGGETTI
  43.  
  44. enum{
  45. OID_WINDOW,
  46. OID_LAYOUT_1,
  47. OID_LBS_GDG_1,
  48. OID_LAST
  49. };
  50.  
  51.  
  52. // DICHIARO UN PUNTATORE DI ARRAY DI TIPO OBJECT
  53.  
  54. Object *object[OID_LAST];
  55.  
  56. //DICHIARO STRUCT LIST E COLUMN INFO PER LISTBROWSER
  57.  
  58. struct ColumnInfo ci[] =
  59. {
  60. { 80, "Col 1", 0 },
  61. { 60, "Col 2", 0 },
  62. { 60, "Col 3", 0 },
  63. { -1, (STRPTR)~0, -1 }
  64. };
  65.  
  66. struct List label_list;
  67.  
  68. // DICHIARO FUNZIONE PER CHIUDERE LE LIBRERIE E INTERFACCE APERTE
  69.  
  70. static void Nube_CloseLibraries(void){
  71.  
  72. if(IListBrowser != NULL){
  73. IExec->DropInterface((struct Interface *)IListBrowser);
  74. }
  75. if(ListBrowserBase != NULL){
  76. IIntuition->CloseClass(ListBrowserBase);
  77. }
  78.  
  79. if(ButtonBase != NULL){
  80. IIntuition->CloseClass(ButtonBase);
  81. }
  82. if(LayoutBase != NULL){
  83. IIntuition->CloseClass(LayoutBase);
  84. }
  85. if(WindowBase != NULL){
  86. IIntuition->CloseClass(WindowBase);
  87. }
  88. if(IIntuition != NULL){
  89. IExec->DropInterface((struct Interface *)IIntuition);
  90. }
  91. if(IntuitionBase != NULL){
  92. IExec->CloseLibrary(IntuitionBase);
  93. }
  94. if(IDOS != NULL){
  95. IExec->DropInterface((struct Interface *)IDOS);
  96. }
  97. if(DOSBase){
  98. IExec->CloseLibrary((struct Library *)DOSBase);
  99. }
  100. }
  101.  
  102. // DICHIARO LO STACK MINIMO RICHIESTO PER IL MIO PROGRAMMA
  103.  
  104. static const char USED minstack[]="$STACK:80000";
  105.  
  106. int main(){
  107.  
  108. // APRO INTUITION LIBRARY
  109.  
  110. IntuitionBase = IExec->OpenLibrary("intuition.library", 52);
  111. IIntuition = (struct IntuitionIFace *)IExec->GetInterface(IntuitionBase, "main", 1, NULL);
  112. if(IIntuition == NULL){
  113. IDOS->Printf("Impossibile aprire la libreria\n");
  114. }else{
  115. IDOS->Printf("Libreria aperta correttamente\n");
  116. }
  117.  
  118. // APRO WINDOW CLASS
  119.  
  120. WindowBase = (struct ClassLibrary *)IIntuition->OpenClass("window.class", 52, &WindowClass);
  121. if(WindowBase = NULL){
  122. IDOS->Printf("impossibile aprire la classe\n");
  123. }else{
  124. IDOS->Printf("classe libreria aperta correttamente\n");
  125. }
  126.  
  127. // APRO LAYOUT CLASS
  128.  
  129. LayoutBase = (struct ClassLibrary *)IIntuition->OpenClass("gadgets/layout.gadget", 52, &LayoutClass);
  130. if(LayoutBase == NULL){
  131. IDOS->Printf("impossibile aprire la classe\n");
  132. }else{
  133. IDOS->Printf("classe aperta correttamente\n");
  134. }
  135.  
  136. // APRO BUTTON GADGET
  137.  
  138. ButtonBase = (struct ClassLibrary *)IIntuition->OpenClass("gadgets/button.gadget", 52, &ButtonClass);
  139. if(ButtonBase == NULL){
  140. IDOS->Printf("impossibile aprire la classe\n");
  141. }else{
  142. IDOS->Printf("classe aperta correttamente\n");
  143. }
  144.  
  145. // APRO LISTBROWSER CLASS
  146.  
  147. ListBrowserBase = (struct ClassLibrary *)IIntuition->OpenClass("gadgets/listbrowser.gadget", 52, &ListBrowserClass);
  148. if(ListBrowserBase == NULL){
  149. IDOS->Printf("impossibile aprire la classe\n");
  150. }else{
  151. IDOS->Printf("classe aperta correttamente\n");
  152. }
  153.  
  154. IListBrowser = (struct ListBrowserIFace *)IExec->GetInterface((struct Library*)ListBrowserBase, "main", 1, NULL);
  155. if(ListBrowserBase == NULL){
  156. IDOS->Printf("impossibile ottenere l'interfaccia\n");
  157. }else{
  158. IDOS->Printf("interfaccia ottenuta correttamente\n");
  159. }
  160.  
  161. object[OID_WINDOW] = IIntuition->NewObject(WindowClass, NULL,
  162. WA_Title, "BOOPSI",
  163. WA_Width, 800,
  164. WA_Height, 600,
  165. WA_DragBar, TRUE,
  166. WA_CloseGadget, TRUE,
  167. WA_SizeGadget, TRUE,
  168. WA_DepthGadget, TRUE,
  169. WA_Activate, TRUE,
  170. WINDOW_IconifyGadget, TRUE,
  171. WINDOW_Position, WPOS_CENTERSCREEN,
  172. WA_NewLookMenus, TRUE,
  173. WA_AutoAdjust, TRUE,
  174. WA_InnerWidth, 400,
  175. WA_InnerHeight, 400,
  176.  
  177. WINDOW_Layout, object[OID_LAYOUT_1] = IIntuition->NewObject(LayoutClass, NULL,
  178. LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
  179. LAYOUT_SpaceOuter, TRUE,
  180. LAYOUT_DeferLayout, TRUE,
  181.  
  182. LAYOUT_AddChild, object[OID_LBS_GDG_1] = IIntuition->NewObject(ListBrowserClass, NULL,
  183. GA_ID, OID_LBS_GDG_1,
  184. GA_Top, 10,
  185. GA_Left, 10,
  186. GA_RelWidth, -34,
  187. GA_RelHeight, -30,
  188. GA_RelVerify, TRUE,
  189. LISTBROWSER_Labels, label_list,
  190. LISTBROWSER_ColumnInfo, ci,
  191. LISTBROWSER_ColumnTitles, TRUE,
  192. LISTBROWSER_MultiSelect, FALSE,
  193. LISTBROWSER_Separators, TRUE,
  194. LISTBROWSER_ShowSelected, FALSE,
  195. LISTBROWSER_Editable, TRUE,
  196. TAG_END) // FINE LISTBROWSER_1
  197. TAG_END), // FINE LAYOUT_1
  198. TAG_END); // FINE LAYOUT FINESTRA
  199.  
  200. IIntuition->IDoMethod(object[OID_WINDOW], WM_OPEN, NULL);
  201. IDOS->Delay(400);
  202. IIntuition->IDoMethod(object[OID_WINDOW], WM_CLOSE);
  203. IIntuition->DisposeObject(object[OID_WINDOW]);
  204.  
  205. Nube_CloseLibraries();
  206.  
  207. return (0);
  208.  
  209. }

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??

Rigo
Rigo's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2011-01-24 21:55
Re: ListBrowser Gadget error..

Looks like you are missing a comma at the end of line 196...

Simon

Nube
Nube's picture
Offline
Last seen: 5 years 6 months ago
Joined: 2012-09-10 02:09
Re: ListBrowser Gadget error..

thanks, you saved my day, I looked into code so many times....

I really appreciate it,

Davide

Log in or register to post comments