How to connect LstNewList to popup trigger table cell?

How to connect LstNewList to popup trigger table cell?

Post by CP » Tue, 06 Nov 2001 03:54:49



Hello,
I need to create an unknown amount of lists at runtime that are connected to
tables with the popup trigger cell type.  Anyone have a snippet of code to
how to do this?
Thanks,
Bri
 
 
 

How to connect LstNewList to popup trigger table cell?

Post by CP » Tue, 06 Nov 2001 10:17:26


To be more specific, here is some code that I am trying.  When I use it I
get an bus error.  Things I don't understand what to put is, what to put in
the triggerId field of the LstNewList().
Thanks.
Bri

UInt16 i = 0;
UInt16 wTable = FrmGetObjectIndex(pForm, MainFieldsTable);
TablePtr pTable = (TablePtr)FrmGetObjectPtr(pForm,wTable);

 TblSetItemStyle (pTable, i, COL_SOURCE, popupTriggerTableItem);

 LstNewList((void **) &pForm,1200,10,10,100,50,boldFont,5,MainFieldsTable);
<-correct triggerId?
 ListPtr pList = (ListPtr)FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm,
1200));

TblSetItemInt(pTable,i,COL_SOURCE,1);
 TblSetItemPtr(pTable,i,COL_SOURCE,pList);
  TblSetRowUsable(pTable,i,true);


Quote:> Hello,
> I need to create an unknown amount of lists at runtime that are connected
to
> tables with the popup trigger cell type.  Anyone have a snippet of code to
> how to do this?
> Thanks,
> Bri


 
 
 

How to connect LstNewList to popup trigger table cell?

Post by Ben Combe » Tue, 06 Nov 2001 13:47:25



Quote:> To be more specific, here is some code that I am trying.  When I use
it I
> get an bus error.  Things I don't understand what to put is, what to
put in
> the triggerId field of the LstNewList().
> Thanks.
> Bri

> UInt16 i = 0;
> UInt16 wTable = FrmGetObjectIndex(pForm, MainFieldsTable);
> TablePtr pTable = (TablePtr)FrmGetObjectPtr(pForm,wTable);

>  TblSetItemStyle (pTable, i, COL_SOURCE, popupTriggerTableItem);

>  LstNewList((void **)

&pForm,1200,10,10,100,50,boldFont,5,MainFieldsTable);
Quote:> <-correct triggerId?
>  ListPtr pList = (ListPtr)FrmGetObjectPtr(pForm,

FrmGetObjectIndex(pForm,

Quote:> 1200));

> TblSetItemInt(pTable,i,COL_SOURCE,1);
>  TblSetItemPtr(pTable,i,COL_SOURCE,pList);
>   TblSetRowUsable(pTable,i,true);

Two things:

1) Each list you create should have a unique ID.  Hard-coding 1200 isn't
a good idea if you create more than one list.

2) Generally, if all the different popupTrigger cells are using the same
set of values, you set each cell to point to the same list, just having
different index values.  Since the list can be shown by only one cell at
a time, this works just fine.  It also lets you use a single,
non-dynamic list instead of using LstNewList, which doesn't work well on
OS versions before 3.5.3 due to dynamic form bugs.

3) the triggerID parameter should be 0.  You don't have a popupTrigger
item for this list you're creating -- the system dynamically assigns it
to the popupTrigger when the cell is activated.

 
 
 

1. design question: status table+log table, indexes, triggers

[postgresql-7.2, pgsql, linux]
Here's a schema-design problem I've hit a few times -- it seems
like there should be a better way:

I have a machine table (140 rows), currently very static:
  machine(machine_name text NOT NULL, machine_id smallint NOT NULL,
          area text NOT NULL, text text NOT NULL);

and a machine_log table (8400 rows), appended to ~4 times/hour:

  machine_log(machine_name text,date timestamp, status text, usr text,
              comment text);

This schema seemed logical at the outset, but the most common query is:
select m.machine_name, m.text, ml.status, ml.date
   from machine m, machine_log ml
   where m.machine_name=ml.machine_name and ml.date=(select max(date)from
machine_log where machine_name=ml.machine_name);

This takes ~25 seconds which is way too long for interactive status check.
The max(date) subselect kills me -- I've tried various indexes but to no avail.
It looks like I need to put status and date_changed columns into the
machine table, even though that info is implicit in the machine_log table.  

Is there some other schema that I'm just not thinking of which neatly
stores some static info about each of a list of things as well as log
info of status changes of those things?

Or is there some index I could create on machine_log that would do the
above query fast?

Finally, I've never used triggers or rules -- what's the best way to
maintain the status and date_changed columns in "machine" automatically
when "machine_log" is appended to?

Thanks,
        George
--
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
        -- Sherlock Holmes in "The Dying Detective"

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command

2. AppMaker question

3. How to trigger a event in main wdw from a popup wdw ?

4. Hard drive access delay in Indigo 2?

5. popup trigger needs double tap to continue

6. 2x CD-Rom doesn't work with some 'home-made' cd's

7. Pop-Up Trigger with dynamic List

8. NLP Job (tentative)

9. I have demo version and can not get a popup trigger to work

10. Popup Trigger/List Troubles

11. Using code to select a list item and shows it in the popup trigger?

12. PopUp Trigger Not Displaying List

13. StrCopy is breaking my Popup Trigger