Page 1 of 1

Memo field connected with check box

Posted: Sat May 31, 2008 9:20 pm
by Ehab Samir Aziz
Hello
I simulate the check box example inside fwbrow.prg in \fwh\samples directory. The same code was imitated but with failure. It is not wotking .
No data tranfered from the checkbox to the field of the dbf. I use tdata class.
Also I need to connect a check box option with memo field . as in the third answer of that question :

How many years did you work :
[] one
[] Two
[] Other
________________________________
________________________________

Code: Select all

method edit(oBrw) CLASS Taplicant
*---------------------------------
   local oDlg,oBtn,oFont

   local oaplicant:= TRecord():new( self )



   local lelected:="E" $ oaplicant:Chosen
   local lappointed:="A" $ oaplicant:Chosen
   local lOther:="O" $ oaplicant:Chosen


   if ::lAdd
      oaplicant:blank()
   endif

   DEFINE DIALOG oDlg FROM 8, 2 TO 725,1050 PIXEL ;
      TITLE if(::lAdd,"Untitled","Update") ;
          Style nor( WS_VSCROLL, WS_HSCROLL ) 

   *DEFINE FONT oFont NAME "Times New Roman" SIZE 0,-12 OF oDlg

   @ 1,2 SAY "&Survey ID" OF oDlg PIXEL
   @ 1,50 SAY ":" OF oDlg PIXEL
   @ 1,60 GET oaplicant:survey_no OF oDlg pict "99999" PIXEL UPDATE


   @ 20,1 SAY "Association Name" OF oDlg PIXEL
   @ 20,50 SAY ":" OF oDlg PIXEL
   @ 20,60 GET oaplicant:ass_name OF oDlg PIXEL UPDATE

   @ 40,1 SAY "Contacy Name" OF oDlg PIXEL
   @ 40,50 SAY ":" OF oDlg PIXEL


   @ 60,1 SAY "Last" OF oDlg PIXEL
   @ 60,50 SAY ":" OF oDlg PIXEL
   @ 60,60 GET oaplicant:cnt_last OF oDlg PIXEL UPDATE

   @ 60,160 SAY "First" OF oDlg PIXEL
   @ 60,210 SAY ":" OF oDlg PIXEL
   @ 60,220 GET oaplicant:cnt_first OF oDlg PIXEL UPDATE

   @ 60,320 SAY "Middle" OF oDlg PIXEL
   @ 60,370 SAY ":" OF oDlg PIXEL
   @ 60,380 GET oaplicant:cnt_middle OF oDlg PIXEL UPDATE


   @ 80,1 SAY "Position Title Within Association" OF oDlg PIXEL
   @ 80,80 SAY ":" OF oDlg PIXEL
   @ 80,90 GET oaplicant:title OF oDlg PIXEL UPDATE

   @ 100,1 SAY "Association Address1 " OF oDlg PIXEL
   @ 100,80 SAY ":" OF oDlg PIXEL
   @ 100,90 GET oaplicant:adres1 OF oDlg PIXEL UPDATE

   @ 120,1 SAY "                     Address2" OF oDlg PIXEL
   @ 120,80 SAY ":" OF oDlg PIXEL
   @ 120,90 GET oaplicant:adres2 OF oDlg PIXEL UPDATE

   @ 140,1 SAY "                     Address3" OF oDlg PIXEL
   @ 140,80 SAY ":" OF oDlg PIXEL
   @ 140,90 GET oaplicant:adres3 OF oDlg PIXEL UPDATE

   @ 160,10 TO 240, 100 LABEL "Chairperson Chosen by:" OF oDlg PIXEL

   @ 180,20 CHECKBOX lElected   PROMPT "&Elected" OF oDlg PIXEL
   @ 200,20 CHECKBOX lAppointed PROMPT "&Appointed"  OF oDlg PIXEL
   @ 220,20 CHECKBOX lOther     PROMPT "&Others" OF oDlg PIXEL


? lElected

  oaplicant:Chosen  := If( lElected, "E", "" ) + ;
                       If( lAppointed,  "A", "" ) + ;
                       If( lOther, "O", "" )




   @ 280, 10 BUTTON oBtn PROMPT "&Save" OF oDlg PIXEL SIZE 30, 12 ;
      ACTION  ( oaplicant:save(), oDlg:end() )

   @ 280, 50 BUTTON oBtn PROMPT "&Cancel" OF oDlg PIXEL SIZE 30, 12 ;
      ACTION  (  oDlg:end() )

   ACTIVATE DIALOG oDlg CENTERED

   oaplicant:end()

return self

Posted: Mon Jun 02, 2008 7:58 am
by Antonio Linares
Could you provide the source code for Class TRecord ? thanks,

Posted: Mon Jun 02, 2008 6:50 pm
by James Bott
Antonio,

Sorry, TRecord is part of TData, my commercial product, so I don't want him posting it.

I am working with Ehab to solve this.

Regards,
James

Posted: Mon Jun 02, 2008 6:52 pm
by James Bott
Ehab,

You have to do this right before the call to save():

oaplicant:Chosen := If( lElected, "E", "" ) + ;
If( lAppointed, "A", "" ) + ;
If( lOther, "O", "" )

So, you need to put it here:

@ 280, 10 BUTTON oBtn PROMPT "&Save" OF oDlg PIXEL SIZE 30, 12 ;
ACTION ( oAplicant:chosen:= ... oaplicant:save(), oDlg:end() )

James