Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filling a grid
Message
From
18/06/2006 11:47:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/06/2006 04:25:51
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01129787
Message ID:
01129812
Views:
14
>Hi all
>I have a grid that the user has to fill it by command button.
>Here is the code:
PUBLIC form1
>  form1= CREATEOBJECT('Form1')
>   form1.Visible = .T.
>form1.show
>DEFINE CLASS form1 AS form
>
>
>	Top = 164
>	Left = 78
>	Height = 267
>	Width = 823
>	DoCreate = .T.
>	Caption = "Filling"
>	Name = "Form1"
>
>
>	ADD OBJECT grid1 AS grid WITH ;
>		Height = 181, ;
>		Left = 36, ;
>		ReadOnly = .T., ;
>		Top = 72, ;
>		Width = 732, ;
>		Name = "Grid1"
>
>
>	ADD OBJECT label1 AS label WITH ;
>		AutoSize = .T., ;
>		Caption = "From Line", ;
>		Height = 17, ;
>		Left = 60, ;
>		Top = 11, ;
>		Width = 58, ;
>		Name = "Label1"
>
>
>	ADD OBJECT combo1 AS combobox WITH ;
>		Height = 24, ;
>		Left = 120, ;
>		Top = 7, ;
>		Width = 48, ;
>		Name = "Combo1"
>
>
>	ADD OBJECT label2 AS label WITH ;
>		AutoSize = .T., ;
>		Caption = "Column #", ;
>		Height = 17, ;
>		Left = 174, ;
>		Top = 11, ;
>		Width = 56, ;
>		Name = "Label2"
>
>
>	ADD OBJECT spinner1 AS spinner WITH ;
>		Height = 25, ;
>		KeyboardHighValue = 12, ;
>		KeyboardLowValue = 1, ;
>		Left = 240, ;
>		SpinnerHighValue =  12.00, ;
>		SpinnerLowValue =   1.00, ;
>		Top = 7, ;
>		Width = 36, ;
>		Value = 1, ;
>		Name = "Spinner1"
>
>
>	ADD OBJECT label3 AS label WITH ;
>		AutoSize = .T., ;
>		Caption = "To Line", ;
>		Height = 17, ;
>		Left = 60, ;
>		Top = 42, ;
>		Width = 43, ;
>		Name = "Label3"
>
>
>	ADD OBJECT combo2 AS combobox WITH ;
>		Height = 24, ;
>		Left = 120, ;
>		Top = 38, ;
>		Width = 48, ;
>		Name = "Combo2"
>
>
>	ADD OBJECT label4 AS label WITH ;
>		AutoSize = .T., ;
>		Caption = "Column #", ;
>		Height = 17, ;
>		Left = 174, ;
>		Top = 42, ;
>		Width = 56, ;
>		Name = "Label4"
>
>
>	ADD OBJECT spinner2 AS spinner WITH ;
>		Height = 25, ;
>		KeyboardHighValue = 12, ;
>		KeyboardLowValue = 1, ;
>		Left = 240, ;
>		SpinnerHighValue =  12.00, ;
>		SpinnerLowValue =   1.00, ;
>		Top = 38, ;
>		Width = 36, ;
>		Value = 1, ;
>		Name = "Spinner2"
>
>
>	ADD OBJECT command1 AS commandbutton WITH ;
>		AutoSize = .T., ;
>		Top = 37, ;
>		Left = 285, ;
>		Height = 27, ;
>		Width = 35, ;
>		FontBold = .T., ;
>		Caption = "Fill", ;
>		Name = "Command1"
>
>
>	PROCEDURE Activate
>		select crsrlines
>	ENDPROC
>
>
>	PROCEDURE Load
>		create cursor crsrlines (titlehead c(1),head1 c(1),;
>		head2 c(1),head3 c(1),head4 c(1),head5 c(1),head6 c(1),head7 c(1),head8 c(1),;
>		head9 c(1),head10 c(1),head11 c(1),head12 c(1))
>		insert into crsrlines (titlehead) values ('A')
>		insert into crsrlines (titlehead) values ('B')
>		insert into crsrlines (titlehead) values ('C')
>		insert into crsrlines (titlehead) values ('D')
>		insert into crsrlines (titlehead) values ('E')
>		insert into crsrlines (titlehead) values ('F')
>		insert into crsrlines (titlehead) values ('G')
>		insert into crsrlines (titlehead) values ('H')
>
>		go top in crsrlines
>	ENDPROC
>
>
>	PROCEDURE combo1.Init
>		this.AddItem('A')
>		this.AddItem('B')
>		this.AddItem('C')
>		this.AddItem('D')
>		this.AddItem('E')
>		this.AddItem('F')
>		this.AddItem('G')
>		this.Value='A'
>	ENDPROC
>
>
>	PROCEDURE combo2.Init
>		this.AddItem('A')
>		this.AddItem('B')
>		this.AddItem('C')
>		this.AddItem('D')
>		this.AddItem('E')
>		this.AddItem('F')
>		this.AddItem('G')
>		this.Value='A'
>	ENDPROC
>
>
>ENDDEFINE
>I Want the following options:
>1. If the user select range in the top the color of the range will be yellow, if he filled it, it's will be blue, otherwise whaite (the user will get an indication what he did and what he planning and going to fill).
>Thank you
  Procedure combo1.InteractiveChange
    Thisform.GridColor(0x00FFFF)
  Endproc
  Procedure combo2.InteractiveChange
    Thisform.GridColor(0x00FFFF)
  Endproc
  Procedure spinner1.InteractiveChange
    Thisform.GridColor(0x00FFFF)
  Endproc
  Procedure spinner2.InteractiveChange
    Thisform.GridColor(0x00FFFF)
  Endproc
  Procedure command1.Click
    Thisform.GridColor(0xFF0000)
  Endproc

  Procedure GridColor
    Lparameters tnColor
    With This.grid1
      .SetAll("DynamicBackColor","")
      Local dynBackColor
      TEXT TO dynBackColor TEXTMERGE NOSHOW PRETEXT 8
IIF(BETWEEN(crsrlines.titlehead,
"<<MIN(this.combo1.value,this.combo2.value)>>",
"<<MAX(this.combo1.value,this.combo2.value)>>"),
<<m.tnColor>>,0xFFFFFF)
      ENDTEXT
      For ix=Min(This.spinner1.Value,This.spinner2.Value) To ;
          Max(This.spinner1.Value,This.spinner2.Value)
        .Columns(m.ix).DynamicBackColor = m.dynBackColor
        .Refresh
      Endfor
    Endwith
  Endproc
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform