Re: [Gtk2forpascal-devel] How to inline a xpm icon?
Brought to you by:
mgaertner
From: Mattias G. <nc-...@ne...> - 2002-07-31 13:27:00
|
On Wed, 31 Jul 2002 20:05:15 +0800 (CST) "mili" <mil...@16...> wrote: > Hello, Every one > > I know that with C I can include a xpm file and then my > executable can run independent on any other file. But I don't know > how to do it under Pascal. XPM files are just c constants. You can include them in pascal if you translate them into a PPChar, i.e. an array of PChar. Perhaps I will write a small script to do this automatically. > I notice that when I remove all picture > files under examples/gtk+/demo/data, the gtk_demo report no picture > file found. Makes sense to me. What's the problem about it? > And another question. I try to construct a menu with the > following code: > >>>>> > const > MenuItems : array [1..5] of TGtkItemFactoryEntry =( > ( path: '/_File'; accelerator: NULL; callback: nil; > callback_action: 0; item_type: '<Branch>'; extra_data: NULL ), > ( path: '/File/_New'; accelerator: '<control>N'; callback: > TGtkItemfactoryCallback(@file_new_clicked); callback_action: 0; > item_type : '<StockItem>'; extra_data: NULL), > ( path: '/File/_Open'; accelerator: '<control>O'; callback: > TGtkItemfactoryCallback(@file_open_clicked); callback_action: 0; > item_type : '<StockItem>'; extra_data: NULL), > ( path: '/File/sep1'; accelerator: NULL; callback: nil; > callback_action: 0; item_type: '<Separator>' ), > ( path: '/File/_Close'; accelerator: '<control>Q'; callback: > TGtkItemfactoryCallback(@file_close_clicked); callback_action: 0; > item_type : '<StockItem>'; extra_data: NULL) > ); > <<<<<<< > > Then When I run it, it can work well but report some error in > console: > > (gbase:1133): Gtk-CRITICAL **: file gtkstock.c: line 128 > (gtk_stock_lookup): assertion `stock_id != NULL' failed > > > What's the problem? In the last line you have to give a stock id. For example: Add this line to your start code: menu_items[2].extra_data:=Pointer(GTK_STOCK_NEW); Due to the strict type checking of pascal it is impossible to set this constant directly. Mattias |