Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checkbox in grid column causing problem
Message
De
26/10/1999 05:30:50
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00279696
Message ID:
00281417
Vues:
11
>It is enabled. If you could send a sample, that would be great. One more question, how do I get rid of other controls in the grid column? I still have another regular checkbox control in the column.
>
>Thanks,
>Doug


Hi Doug,
Yesterday I had to leave early :(

If designtime and visually,
-Select the control you want to remove in PEM sheet,
-Click somewhere in form design area (ie: window Title) to set focus back to form
-Press "del"

If in code :
...Columns(n).RemoveObject("Object2Remove")

Here is the sample code. It changed a little bit from what I said before :) I sent directy runnable code version to make it public, you could transfer this to a visual class easily :
Create cursor myCursor (f1 c(10), f2 i, f3 l)
Rand(-1)
For ix = 1 to 10
  Insert into myCursor values ( chr(65+ix-1), ix, (int(rand()*1000)%2 = 0) )
Endfor
Go top
oForm = createobject("Form")
With oForm
  .Width = 500
  .Height = 400
  .Closable = .f.
  .AddObject("myQuit","myQuit")
  .myQuit.visible = .t.
  .AddObject("myGrid","Grid")
  With .myGrid
    .Left = 2
    .Top = 2
    .Width = 300
    .Height = 350
    .RecordSource = "myCursor"
    With .Columns(3)
      .Width = 22
      .AddObject("myCheckBox","myChkBox",.ControlSource) && Pass controlsource to container
      .CurrentControl = "myCheckBox"
      .Sparse = .f.
      .myCheckBox.Visible = .t.
    Endwith
    .Visible = .t.
  Endwith
  .AddObject("KeyPressNotify","TextBox")
  .AddObject("DblClickNotify","TextBox")
  With .KeyPressNotify
    .Top = 2
    .Left = 310
    .Width = .Parent.Width - .Left - 2
    .Visible = .t.
  Endwith
  With .DblClickNotify
    .Top = 4 + .Height
    .Left = 310
    .Width = .Parent.Width - .Left - 2
    .Visible = .t.
  Endwith
  .Show
Endwith
Read events

Define class myChkBox as Container
  ControlSource = ""  && Custom property
  Procedure init
    Lparameters tcControlSource
    With this
      If parameters()=1
        .ControlSource = tcControlSource
      Endif
      .BackStyle = 0    && Transparent
      .BorderWidth = 0
      .Width = .Parent.Width
      .Height = .Parent.Parent.RowHeight
      .AddObject("Txt1","myTxt")
      .AddObject("Chk1","myChk")
      .AddObject("Shp1","myShape")
      .Txt1.visible = .t.
      .Chk1.Visible = .t.
      .Shp1.Visible = .t.
    Endwith
  Endproc
Enddefine

Define class myChk as CheckBox
  Procedure init
    With this
      .Caption = ""
      .Height = 18
      .Width = 18
      .BackStyle = 0    && Transparent
      .Left = int((.Parent.Width - .Width) / 2) && Center horz.
      .Top = int((.Parent.Height - .Height) / 2) && Center vert.
      .ControlSource = .Parent.ControlSource    && Get Controlsource from parent's custom prop.
      .Enabled = .f.
    Endwith
  Endproc
Enddefine

Define class myShape as Shape
  Procedure init
    With this
      .Left = 0
      .Top = 0
      .Width = .Parent.Width
      .Height = .Parent.Height
      .BackStyle = 0    && Transparent
      .BorderStyle = 0
    Endwith
  Endproc
  Procedure dblClick
    Thisform.DblClickNotify.value = datetime()
  Endproc
Enddefine

Define class myTxt as textbox
  Left = -100  && Enabled but not visible
  Top = -100
  Procedure keypress
    Lparameters nKeyCode, nShiftAltCtrl
    Thisform.KeyPressNotify.value = datetime()
  Endproc
Enddefine

Define class myQuit as CommandButton
  Procedure init
    With this
      .Caption = "Exit"
      .Left = 310
      .Top = 380
    Endwith
  Endproc
  Procedure Click
    Thisform.release
    Clear events
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform