[Gambas-user] Gridview

Steven Lobbezoo steven at ...1652...
Mon Sep 3 11:51:33 CEST 2007


Le samedi 1 septembre 2007 20:47, Benoit Minisini a écrit :
> On mercredi 22 août 2007, Steven Lobbezoo wrote:
> > Hi,
> >
> > Sorry to bother you inmidst all this exitement on the new web-site
> > with a simple question on gambas, ;-) but :
> >
> > If I do :
> >   GridView2.Current.ForeColor = Color.DarkRed
> >
> > or any other property of the current cell in the color range (BackColor,
> > ....) the contents of the cell is eraised.
> >
> > Is this normal behaveour ?
> >
> > Thanks,
> > Steven
>
> Hi,
>
> I cannot reproduce the bug you describe. Can you send some code?
>
> Regards,
Hi,

Sorry for the delay (I had some days of ;-) )
but here it is :
-------------------------------------------------------------------------------------------
PUBLIC SUB GridView2_Click()
DIM rfield AS ResultField
DIM ctrl AS Control
DIM Lbox AS ComboBox
DIM tmp AS String

' if we where just selecting :
  IF Dren = 1 THEN 
    IF GridView2.Row THEN 
      Object.SetProperty(ME.Tag, "Tag", Gridview2[Gridview2.Row, 0].Text)
      Object.SetProperty(ME.Tag, "Text", Gridview2[Gridview2.Row, 2].Text 
& " - " & Gridview2[Gridview2.Row, 4].Text)
    END IF      
    ME.Close
    RETURN
  END IF
' we check if we had one, and maybe want to update him
  IF rsD THEN 
    Update_data
  END IF
  GridView2.Current.ForeColor = Color.DarkRed    <----------------- there
' we act depening where we clicked (it's in row)
  rsD = db.Exec("Select * from Clients where No = &1", Gridview2
[Gridview2.row, 0].Text)
' try this :

  FOR EACH ctrl IN ME.Controls
      FOR EACH rfield IN rsD.fields
        IF rfield.Name <> "No" THEN     
          IF Object.GetProperty(ctrl, "Name") = rfield.Name THEN
            IF rfield.Name = "TypeLiaison" THEN 'this is a list control
              Lbox = ctrl
              Lbox.Index = Lbox.Find(Str(rsD[rfield.Name]))
              Object.SetProperty(ctrl, "Tag", Str(rsD[rfield.Name]))
              ctrl = Lbox
            ELSE IF rField.Name = "Ne" THEN 
              Ne.Value = rsD["Ne"]
              Ne.Tag = Ne.Value
            ELSE IF rField.Name = "Mariage" THEN 
              Mariage.Value = rsD["Mariage"]
              Mariage.Tag = Mariage.Value
            ELSE 
              Object.SetProperty(ctrl, "Text", Str(rsD[rfield.Name]))
              Object.SetProperty(ctrl, "Tag", Str(rsD[rfield.Name]))
              IF rfield.Name = "Spouse" THEN 
                IF rsD["Spouse"] THEN
                  rsE = db.Exec("select Nom, Prenom from Clients where No = " 
& Str(rsD["Spouse"]))
                  tmp = rsE["Prenom"] & " " & rsE["Nom"]
                  SpouseN.Text = tmp 
                ELSE 
                  SpouseN.text = ""                   
                END IF
              END IF
            END IF
            BREAK
          END IF
        END IF
      NEXT 
  NEXT

    Nom.SetFocus
    
CATCH
'  Message.Error(Error.Text)  
END


Thanks,
Steven




More information about the User mailing list