swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Widget refresh


From: Marcus G. Daniels
Subject: Re: Widget refresh
Date: 19 Oct 2000 21:13:00 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "LB" == BEN SAID Lamjed thesard FTRD/DTL/LAN <address@hidden> writes:

LB>  I have a set of Entry widgets bound together in one
LB> frame. During the simulation, the values of the linked variables
LB> to these input widgets change however values on the displayed
LB> window (frame) do not. 

You have to make calls (typically, indirectly) on the Entry's setValue: method
in order to update the displayed value.

#import <simtools.h>
#import <gui.h>
#import <objectbase/SwarmObject.h>

@interface Controller: SwarmObject
{
  id entry1;
  id entry2;
  int intVar;
  int unusedIntVar;
}
- createEnd;
- (void)describe: outputCharStream;
@end

@implementation Controller

- createEnd
{
  id frame = [Frame create: [self getZone]];

  [frame setWindowTitle: "MyFrame"];
  entry1 = [Entry createParent: frame];
  [entry1 linkVariableInt: &intVar];
  [entry1 pack];

  entry2 = [Entry createParent: frame];
  [entry2 linkVariableInt: &unusedIntVar];
  [entry2 pack];
  
  return self;
}

- update
{
  [entry1 setValue: [entry1 getValue]];
  [entry2 setValue: [entry1 getValue]];
  return self;
}

- (void)describe: outputCharStream
{
  char buf[10];

  sprintf (buf, "%d", intVar);
  [outputCharStream catC: buf];
  [outputCharStream catC: "\n"];
}

@end

int
main (int argc, const char **argv)
{
  id controller;

  initSwarm (argc, argv);

  controller = [Controller create: globalZone];

  while (1)
    { 
      [controller update];
      while (GUI_EVENT_ASYNC ()) {}
    }
}

/*
Local Variables:
compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -D_GNU_SOURCE -o 
TestEntry -g -Wno-import -I$SWARMHOME/include -I$SWARMHOME/include/swarm 
-L/$SWARMHOME/lib/swarm -L$SWARMHOME/lib TestEntry.m -lobjc -lswarm"
End:
*/



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]