[comp.sys.next] help with IB and Forms

dpaulso@k30b.nswc.navy.mil (Dave Paulson) (05/07/91)

I'm trying to use IB to put together a real simple application, and I
seem to be having some trouble getting float values out of my
three-celled input form.

I'm using code more or less like

	X=[myForm floatValueAt:i]

where X is a float, myForm is the id of the Form object that I dragged
in from IB, and i is the integer index of the cell that i'm interested
in within the form. 

Does this look reasonable?  If it does, then how about the connections
I've established in IB:

The input form is connected to a button, which is connected to an object
that is a subclass of Object.  This object contains the method that
gathers the float values from the form, and then writes to an
outputForm.  The writing step works, but the result is bogus because the
reading step is not working.  

In fact, even  [myForm getNumRows:&r numCols:&c]
returns bogus values for ints ``r'' and ``c''.
Is this a related problem?

Thanks in advance for any hints or help!

/dave

--
Dave Paulson            dpaulso@relay.nswc.navy.mil (work)
Synetics/NAVSWC         talos!SandBox!dave@uunet.uu.net (home,NeXTmail)

sdd@oceania (05/09/91)

In article <1991May7.164814.15885@relay.nswc.navy.mil>  
dpaulso@k30b.nswc.navy.mil (Dave Paulson) writes:
> I'm trying to use IB to put together a real simple application, and I
> seem to be having some trouble getting float values out of my
> three-celled input form.
> 
> I'm using code more or less like
> 
> 	X=[myForm floatValueAt:i]
> 
> where X is a float, myForm is the id of the Form object that I dragged
> in from IB, and i is the integer index of the cell that i'm interested
> in within the form. 
> 
> Does this look reasonable?  If it does, then how about the connections
> I've established in IB:
> 
> The input form is connected to a button, which is connected to an object
> that is a subclass of Object.  This object contains the method that
> gathers the float values from the form, and then writes to an
> outputForm.  The writing step works, but the result is bogus because the
> reading step is not working.  
> 
> In fact, even  [myForm getNumRows:&r numCols:&c]
> returns bogus values for ints ``r'' and ``c''.
> Is this a related problem?
> 
> Thanks in advance for any hints or help!
> 
> /dave
> 
> --
> Dave Paulson            dpaulso@relay.nswc.navy.mil (work)
> Synetics/NAVSWC         talos!SandBox!dave@uunet.uu.net (home,NeXTmail)

Forgive me if this response is obvious (i.e. something you have already  
considered), just thought I would share my $0.02.

When dragging connections to forms in interface builder, it is very easy to  
make the connection to one of the cells instead of the entire form.  I imagine  
if you did this, your program would probably crash with an IOT trap error  
(FormCell does not respond to someMethodDefinedInForm).

Have you tried using gdb to inspect the id of the form object you are using.  I  
have found this to be one of the best ways to track wild objects.  In gdb, if  
the pointer you have to the form is called myForm, then you can look at all the  
instance variables, etc. with:

(gdb) p *myForm

If this shows you something crazy, then you know you got problems.  If you  
can't make much of it, do a:

(gdb) p (char *)[myForm name]

this will display the name of the object, like: "Form", or "FormCell", etc.

Hope this helps some.

--
+-----------------------------+
|         Steve Dakin         |
|  oceania!sdd@uunet.uu.net   |
|         (NeXT mail)         |
+-----------------------------+
-- 
+-----------------------------+
|         Steve Dakin         |
|  oceania!sdd@uunet.uu.net   |
|         (NeXT mail)         |