On Mon, 30 Jan 2006, Mathias PARNAUDEAU wrote:

> Le 29/01/2006, Ilkka Lehtoranta a écrit:
> 
> >> I have a multicolumn List object to display the result of a SQL request
> >> done with SQLite. Everything is right with my hooks and now I want to add
> >> title to the columns. Reading the autodoc file, the title naming seems to
> >> be quite static. The problem is I obtain the column names dynamically.
> 
> > Titles are set in the display hook. MUIM_InitChange/ExitChange probably 
> > does the trick here (call it once you have received titles).
> 
> Titles are set in the display hook but we can't give our own data structure
> to this function because if we set MUIA_List_Title to TRUE (means
> multicolumn title), MUI calls the display hook with a NULL value at the
> third parameter.
> 
> I don't understand what I have to do with MUIM_Group_InitChange/ExitChange
> ... :-(

Ah, never mind... i thought of different problem (which probably doesnt 
exist).

> The autodoc tells about this line " struct Data *data = hook->h_Data; " but
> the data variable is not used in the example ...
> 
> You can have a look at what I do here :
> http://amigadev.free.fr/sqlite/AP34_03.jpg
> and the source :
> http://amigadev.free.fr/sqlite/AP34_03.c (attached to this mail too)

Your display hook would be something like this:

HOOKPROTO(ResultList_Display, ULONG, char **array, struct ReqData *reqdata)
{
   if (reqdata) {

      int n;
      for (n=0; n<reqdata->nb ; n++) {
                *array++ = reqdata->columns[n];
      }
   } else {
     reqdata = (struct ReqData *)hook->h_Data;  // list titles

     int n;

     for (n=0; n<reqdata->nb ; n++) {
                *array++ = reqdata->columns[n];
     }
   }

   return 0;
}
MakeStaticHook(hook_ResultList_Display, ResultList_Display);

Somewhere in your code you set h_Data:

  hook_ResultList_Display.h_Data = (APTR)reqdata_titles;

or something like this...



  Ilkka



Visit http://www.amiga.dk/tumult for MUI-related
information, especially about MUI custom classes. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MUI/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to