KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

GridView Sticky Discussion
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 5:48 pm    Post subject: Reply with quote

I like the SubGrid in the northwind.mdb, are we going to see that veritility?
It would be nice to be able to link a SubGrid to another Grid or maybe a table like any other DB type thingy.

I would like to also see the dropdown thing visible like Jochen sugested.

Shawn, you ROCK!

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 5:59 pm    Post subject: Reply with quote

Thanks, sub-grids are a possibilty but not in the short-mid-term. Really, they're just cells with the celltype set to GridView ? ;0)

In terms of the ComboBox thingy - I played-with/reviewed many grids when I was developing GridView - MS grids and third party grids. tbh - if there was any "magical" grid that I could have modeled GridView after - I probably would have "went for it" but tbh ... ALL GRIDS OUT THERE have their share of wierd syntax and warts ... some are better than others, some are down-right goofy.

Got to tell you about this one grid I saw, the developer named all the property and methods names in a "hungarian-notation-like" fashion. Hungarian notation is great with code, but for COM objects - it looks strange to say the least, for example:

$GridView.strText = ""
$GridView.dblValue = 0.0
$GridView.bVisible = 0

idk - looked wierd.

Back to ComboBox, there are two schools of thought, I've seen grids that (for comboboxes), have all the comboboxes visible in every cell - all the time - and some have them "visible" when you click on a cell in a column (just on the one you clicked on). The other cells hide the combobox.

Dont know about you, but having an enitre column filled-up with visible comboboxes is (ummm) cluttered. So I think I want to do the latter (combobox visible when single-clicked-on (aka when the cell is activated)).

The CheckBox actually works the former way - you see all the checkboxes all the time ... i've seen grids hide those (unless activated as well) - hidden checkboxes are even weirder than the combobox is right now).

-Shawn
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 6:09 pm    Post subject: Reply with quote

Would it be posable to give the scripter the choice like:
$GridView.Columns(2).CellType = "Combobox"
$GridView.Columns(2).CellType.Visible = True

I'm sure there is a better way but you get the idea.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 6:31 pm    Post subject: Reply with quote

Lets try adding the single-click-activation method for comboboxes, then we can give it go - then maybe think-up a new property name to switch it on and off. ja?
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 7:19 pm    Post subject: Reply with quote

Is there a way to sort a column once it has been populated other than a click on the header?
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 7:32 pm    Post subject: Reply with quote

Also is there a OnClick for the ComboBox like:

$GridView.Cells($x,2).OnClick = "CheckCombobox()"

maybe you haven't had a chance to go that far. Sorry I don't want this to sound pushy.

Have I told you:

Shawn you ROCK!

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 7:41 pm    Post subject: Reply with quote

Sorting ... there are going to be a few differenent ways on which one can sort, but right now only one if implemented through code (other then clicking the header) ...

GridView.Sort Method

Summary:
Sorts the contents of the GridView control in ascending or descending order based on the contents of the specified column.

Syntax:
object.Sort( column, direction )

Parameters:
column: The column by which to sort the contents of the gridview.

direction: One of the SortDirection values.



and subsequently:


SortDirection Enumeration


Summary:
Specifies the direction of a sort operation.

Members
Value Description
0 Ascending
1 Descending




-----


(this is a snippet from the TBD CHM ;o| )

In terms of the ComboBox, not sure if this is what your looking for:

Code:

$GridView.OnCellValueChanged = "CellValueChanged()"

Function CellValueChanged()

 ?"Value=" $GridView.CurrentCell.Value

EndFunction


Its funny you asked, because using currentcell as the "object" in the CellValueChanged event can lead to a problem ... five stars if you can figure out a situation in which using CurrentCell doesn't work.

-Shawn
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 8:12 pm    Post subject: Reply with quote

Well a single click on a non-combo box cell then a single click on another non-combo box cell without making any changes executes the function weather or not a cell value has been changed, how would you know if it had been changed or not?

more simply:
if the data in a non-combo box cell is accessed (Changed or Not) the Function is called.
Without knowing the value of the data before a potential change you have nothing to compare to.

Is this what you mean?

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 8:19 pm    Post subject: Reply with quote

I said that wrong;
access the data in cell 1 (double click)
click once on cell 2 and you get the data from cell 2 not 1

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 8:36 pm    Post subject: Reply with quote

hehee, you got it ... btw check-out the comboxes in the newest dev build - let me know if its getting better ...
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 8:41 pm    Post subject: Reply with quote

Heres a grid I've been funn'n with:

[Grid]
RowCount=50
ColumnCount=8
AllowSorting=-1
AlternatingBackColor=16247783
BackColor=16777215
ColumnHeaderStyle=2
FontName=Courier New
FontSize=10
ForeColor=0
GridLineColor=15187604
Locked=0
SelectionMode=0
[0]
Alignment=0
BackColor=-1
CellType=0
ForeColor=-1
Name=Name
Locked=0
Width=96
ValueType=8
[1]
Alignment=0
BackColor=-1
CellType=0
ForeColor=-1
Name=Age
Locked=0
Width=62
ValueType=5
[2]
Alignment=0
BackColor=-1
CellType=3
ForeColor=-1
Name=Married
Locked=0
Width=72
ValueType=8
Items=True|False|
[3]
Alignment=0
BackColor=-1
CellType=0
ForeColor=-1
Format=$0.00
Name=Salary
Locked=0
Width=101
ValueType=6
[4]
Alignment=2
BackColor=-1
CellType=2
ForeColor=-1
Name=Rating
Locked=0
Width=111
ValueType=8
Items=True|False|Poor|Average|Good|Excellent|
[5]
Alignment=0
BackColor=-1
CellType=0
ForeColor=-1
Format=MMM-yyyy
Name=Birth Date
Locked=0
Width=100
ValueType=7
[6]
Alignment=0
BackColor=-1
CellType=0
ForeColor=-1
Name=G
Locked=0
Width=100
ValueType=8
[7]
Alignment=0
BackColor=-1
CellType=0
ForeColor=-1
Name=H
Locked=0
Width=100
ValueType=8
[0.0]
Value=Christopher
[0.1]
Value=10
[0.2]
Value=False
[0.3]
Value=100000
[0.4]
Value=Excellent
[0.5]
Value=1994/05/01
[1.0]
Value=Shawn
[1.1]
Value=43
[1.2]
Value=True
[1.3]
Value=75000
[1.4]
Value=Excellent
[1.5]
Value=1961/09/01
[2.0]
Value=Jessica
[2.1]
Value=13
[2.2]
Value=False
[2.3]
Value=50000
[2.4]
Value=Excellent
[2.5]
Value=1991/08/01
[3.0]
Value=Lori
[3.1]
Value=43
[3.2]
Value=True
[3.3]
Value=25000
[3.4]
Value=Excellent
[3.5]
Value=1961/04/01
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 8:59 pm    Post subject: Reply with quote

here is the updated script with the changes:

$GridView.OnCellValueChanged = "CheckCombobox()"
and
$Row = $GridView.Rows.Add()

Code:

;region Setup Variables
$Domain = @Domain
$Version = "Build(1.0.0.1)"
$SystemDir = %SystemROOT%
$InstallDirectory = "$SystemDir\System32"
$TempDir = %ASESCRIPTPATH%
$objRootDSE = GetObject("LDAP://rootDSE")
If Not $objRootDSE = ""
   $defaultNamingContext = $objRootDSE.Get("defaultNamingContext")
EndIf
$System = CreateObject("Kixtart.System")
$fontsize = 8.25
;endregion

;region Main Form
Break On

$Form = $System.Form()
$Form.Size = 650,480
$Form.Font = $System.Font("Verdana",$fontsize)
$Form.Text = "GridView " + $VERSION
$Form.Icon = 61

;region MENUs
$Menu = $System.MainMenu()
$Menu.Style = 0
$Menu.ImageLiSt = $System.BuiltinImageLiSt()

$FileMenu = $Menu.MenuItems.Add("File")
$ExitMenu = $FileMenu.MenuItems.Add("Exit")
$ExitMenu.ImageIndex = 60
$ExitMenu.Shortcut = "Alt+F4"
$ExitMenu.ShortcutText = "Alt+F4"
$ExitMenu.OnClick = "OnExit()"

$EditMenu = $Menu.MenuItems.Add("Edit")

$ToolsMenu = $Menu.MenuItems.Add("Tools")
$GMSMenu = $ToolsMenu.MenuItems.Add("Get Manageable Services")
$GMSMenu.ImageIndex = 56
$GMSMenu.Shortcut = "Ctrl+F1"
$GMSMenu.OnClick = "GridviewUpdate()"

$Form.Menu = $Menu
;endregion

;region Status Bar
$StatusBar = $Form.StatusBar()
$StatusBar.Dock = "Bottom"
$StatusBar.DockPadding = 4,2,2,2

$ProgressBar = $StatusBar.Controls.Progressbar()
$ProgressBar.Maximum = 100
$ProgressBar.Minimum = 0
$ProgressBar.Style = 1
$ProgressBar.Step = 10
$ProgressBar.Dock = "Right"
$ProgressBar.Width = 100
$ProgressBar.Left = $form.Width - $ProgressBar.Width - 25

$StatBarInfo = $StatusBar.Controls.Label()
$StatBarInfo.BorderStyle = 2
$StatBarInfo.TextAlign = "MiddleLeft"
$StatBarInfo.Dock = "Fill"
;endregion

;region Form Controls
$MainSplit = $Form.SplitContainer()
$MainSplit.Dock = "Fill"
$MainSplit.SplitterDistance = 0.20 * $MainSplit.ClientWidth
$MainSplit.Panel1Collapsed = 1

$TreeView = $MainSplit.Panel1.TreeView()
$TreeView.Dock = "Fill"
$TreeView.OnDoubleClick = "TreeViewDoubleClick()"
$TreeView.ImageList = $System.BuiltinImageList

$TablesNode = $TreeView.Nodes.Add("Tables")
$TablesNode.ImageIndex = 45
$TablesNode.SelectedImageIndex = 46

$ViewsNode = $TreeView.Nodes.Add("Views")
$ViewsNode.ImageIndex = 45
$ViewsNode.SelectedImageIndex = 46

$GridView = $MainSplit.Panel2.GridView()
$GridView.Dock = "Fill"

$ErrorBox = $System.MessageBox()
$ErrorBox.Title = $TITLE
$ErrorBox.Icon = $System.MessageBoxIcon.Error
;endregion

$GridView.Focus()

$Form.Center
$Form.Show
GridviewUpdate()

While $Form.Visible
 $= Execute($Form.DoEvents())
Loop
Exit 1
;endregion

;region Form Functions

Function AdvanceProgressBar($Step,Optional $Text)
   $Count = $Count + $Step
   If $Count > 100
      $Count = 0
   EndIf
   $StatBarInfo.Text = $Text
   $ProgressBar.Value = $Count
   
   Sleep 0.05
EndFunction

Function ClearGrid()
   $GridView.BeginUpdate
   $GridView.RowCount = 0
   $GridView.ColumnCount = 3
   $GridView.Columns(0).Width = 150
   $GridView.Columns(1).Width = 150
   $GridView.Columns(2).Width = 100
   $GridView.Columns(0).HeaderText = "Display Name"
   $GridView.Columns(1).HeaderText = "Service Name"
   $GridView.Columns(2).HeaderText = "Status"
   $GridView.EndUpdate
EndFunction

Function GridviewUpdate() ;$RowCount
   Dim $row
   
   ClearGrid()
   
   $MainSplit.Panel1Collapsed = 1
   
   $GridView.BeginUpdate
   $GridView.RowCount = 0
   $GridView.ColumnCount = 0
   $GridView.ColumnCount = 3
   $GridView.Columns(0).HeaderText = "Display Name"
   $GridView.Columns(1).HeaderText = "Service Name"
   $GridView.Columns(2).HeaderText = "Status"
   $GridView.Columns(2).CellType = "Combobox"
   $GridView.OnCellValueChanged = "CheckCombobox()"
   
   $StatusListItems = $System.ListItemCollection()
   $= $StatusListItems.Add("Started")
   $= $StatusListItems.Add("Stoped")
   $GridView.Columns(2).Items = $StatusListItems

   $x = 0
   $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + @WKSTA + "\root\cimv2")
   $colServices = $objWMIService.ExecQuery ("Select * from Win32_Service")
   For Each $objService in $colServices
      $Row = $GridView.Rows.Add()
      AdvanceProgressBar(1,"Adding " + $objService.DisplayName)
      $GridView.Cells($x,0).Text = $objService.DisplayName
      $GridView.Cells($x,1).Text = $objService.Name
      If $objService.Started = -1
         $GridView.Cells($x,2).Value = "Started"
         $GridView.Cells($x,2).ForeColor = "Green"
      Else
         If $objService.Started = 0
            $GridView.Cells($x,2).Value = "Stoped"
            $GridView.Cells($x,2).ForeColor = "Red"
         EndIf
      EndIf
      $x = $x + 1
   Next
   ;$GridView.Sort(0,"ascending")
   $GridView.Sort(0,0)
   $GridView.Columns(0).Width = -1
   $GridView.Columns(1).Width = -1
   
   $GridView.CurrentRowIndex = 0
   $GridView.CurrentColumnIndex = 0
   $GridView.EndUpdate
   $Count = 0
   AdvanceProgressBar(0,"")
   $Form.width = $GridView.Columns(0).Width + $GridView.Columns(1).Width + $GridView.Columns(2).Width + 30
EndFunction

Function CheckCombobox()
;  * Location Options *
;   CurrentRow
;   CurrentRowIndex
;   CurrentColumn
;   CurrentColumnIndex
;   CurrentCell
   $GridView.Enabled = "false"
   $Index = $GridView.CurrentRowIndex
   $ServiceName = $GridView.Cells($Index,1).Value
   $Status = $GridView.Cells($Index,2).Value
   If $Status = "Started"
      StartServerService($ServiceName)
   Else
      If $Status = "Stoped"
         StopServerService($ServiceName)
      EndIf
   EndIf
   GridviewUpdate()
   $GridView.Enabled = "true"

EndFunction

Function StopServerService($Service)
   $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + @WKSTA + "\root\cimv2")
   $colServiceList = $objWMIService.ExecQuery("Associators of {Win32_Service.Name='$Service'} Where AssocClass=Win32_DependentService Role=Antecedent" )

   For Each $objService in $colServiceList
      $errReturn = $objService.StopService()
   Next

   Sleep 3

   $colServiceList = $objWMIService.ExecQuery ("Select * from Win32_Service where Name='$Service'")

   For Each $objService in $colServiceList
      $errReturn = $objService.StopService()
   Next
EndFunction

Function StartServerService($Service)
   $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + @WKSTA + "\root\cimv2")
   $colServiceList = $objWMIService.ExecQuery ("Select * from Win32_Service Where Name='$Service'")
   
   For Each $objService in $colServiceList
      $errReturn = $objService.StartService()
   Next
   
   Sleep 3
   
   $colServiceList = $objWMIService.ExecQuery("Associators of {Win32_Service.Name='$Service'} Where AssocClass=Win32_DependentService Role=Dependent" )
   
   For Each $objService in $colServiceList
      $errReturn = $objService.StartService()
   Next
EndFunction

;endregion

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)


Last edited by benny69 on Mon Jun 06, 2005 1:28 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Jan 12, 2005 9:03 pm    Post subject: Reply with quote

I would like to the the code that you are useing for pulling the .ini info.
at least it looks like an .ini file.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 9:05 pm    Post subject: Reply with quote

Little trick you can do, to autosize the column-width the largest text string, is this:

$GridView.Columns(0).Width = -1
$GridView.Columns(1).Width = -1

;$GridView.Columns(0).Width = ($DNW * $fontsize) + 100
;$GridView.Columns(1).Width = ($NW * $fontsize) + 100

-Shawn
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Jan 12, 2005 9:08 pm    Post subject: Reply with quote

Whats that about the INI file ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group