Page 1 of 1

visible of buttons in datagrid

Posted: Wed May 25, 2016 7:51 am
by razvan
Hello!
I'am beginner and I try to learn how to use datagrid in livecode
I attached an url video.
In this video I put some buttons for call ,mail, message and job_title of people .
When I click on the row I want to disappear job title and appear buttons but is not working properly.
You will see buttons appear down or up after scrolling.
Can someone help me to set this?
here is row behavior code:

Code: Select all

on FillInData pDataArray
   -- This message is sent when the Data Grid needs to populate
   -- this template with the data from a record. pDataArray is an
   -- an array containing the records data.
   -- You do not need to resize any of your template's controls in
   -- this message. All resizing should be handled in resizeControl.
   
   -- Example:
   set the text of field "ID" of me to pDataArray["ID"]
   set the text of field "Name" of me to pDataArray["Name"]
   set the text of field "Mob" of me to pDataArray["Mob"]
   set the label of button "Call" of me to pDataArray["Mob"]
   set the label of button "Message" of me to pDataArray["Mob"]
   set the text of field "SecondName" of me to pDataArray["SecondName"]
   set the text of field "eMail" of me to pDataArray["eMail"]
    set the text of field "job_title" of me to pDataArray["job_title"]
    set the text of image "pic" of me to pDataArray["Picture"] 
    set the label of button "Email"of me to pDataArray["eMail"]
    set the tooltip of button "Email" of me to pDataArray["eMail"]
    
    set the visible of field "job_title" to true
    set the visible  of button "Call" of me to false
    set the visible  of button "email" of me to false
    set the visible  of button "message" of me to false


end FillInData

Code: Select all

on mouseUp pBtnNum
   global idImage,  gEmail,gthelinegrid1

   if pBtnNum is 1 then
      put empty into gEmail
      put the dgHilitedLines of group "DataGrid" into theLine
      put the dgDataOfLine[theLine] of group "DataGrid" into theDataA
      
      ## theDataA is now an array variable.
      ## In the case of the Data Grid pictured above the keys of the array are id, FirstName, LastName and Title.
      
      ## This answer dialog will display: Dusty Bottoms
      --answer theDataA["Name"] && theDataA["Mob"]
      --put theDataA["Mob"] into field "info"
 
      put theDataA["Mob"] into nr_phone
      put " " after char 3 of nr_phone
      put " " after char 8 of nr_phone
      
      put " " after char 12 of nr_phone
      put nr_phone into field "info"
      put theDataA["Picture"] into img "imagecontainer"
      put "To: "&theDataA["SecondName"] into field "to:"


      --here I put the code for visible of buttons

           send "RefreshList" to grp "dataGrid"
           set the visible of button"call" of me to true 
           set the visible of button"Email" of me to true
           set the visible of button "message" of me to true
           set the visible of field "job_title" of me to false

      
      
   end if
https://www.youtube.com/watch?v=W1qS0eX ... e=youtu.be
Thanks
Kind Regards
Razvan