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

Some tricky ones

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
AJ83
KiXforms Follower
KiXforms Follower


Joined: 14 Jun 2007
Posts: 16

PostPosted: Mon Jan 14, 2008 3:01 pm    Post subject: Some tricky ones Reply with quote

Hi!

My application Declaration Processor is in production right now. 8 people entering about 1000 medical bill`s into a SQL database with it each day.
Now i got some requests from the users to make it more userfriendly.

I have a readonly combobox (wich makes it a dropdown menu) and i want to automaticly drop it down at some point. Is this even possible?

I also had the request to make a certain listview always show the bottom row. So it should automaticly scroll down everytime something is added.

I`ve tried:

$declaratiecount = $LV_declaratie.Items.Count
$declaratiecount = $declaratiecount - 1
$ = $LV_declaratie.Items.Item($declaratiecount ).Focused
And
$ = $LV_declaratie.Items.Item($declaratiecount ).Selected

to make it select the last row. But it doesn`t work.

Even tried to focus the listview and arrowdown sendkeys, but that doesn`t really work well.

Could someone shed some light on these issues?

Thanks in advance!
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Mon Jan 14, 2008 3:37 pm    Post subject: Reply with quote

Try with .SelectedIndex ... This is the read write property in kf Classic .. Dunno if this works similar in kf.Net
_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
AJ83
KiXforms Follower
KiXforms Follower


Joined: 14 Jun 2007
Posts: 16

PostPosted: Mon Jan 14, 2008 4:17 pm    Post subject: Reply with quote

Didnt work.... Crying or Very sad maybe the whole syntax for identifying the row is wrong.
Thanks anyway, was worth a try Wink
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Mon Jan 14, 2008 5:10 pm    Post subject: Reply with quote

Focused and Selected are properties, not methods.

Try

Code:

$LV_declaratie.Items.Item($declaratiecount ).Focused = -1


Or

Code:

$LV_declaratie.Items.Item($declaratiecount ).Selected = -1


I'm not sure what you're asking regarding the read-only combobox.
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: Mon Jan 14, 2008 5:25 pm    Post subject: Reply with quote

Hi Aj,

as far as the ComboBox I don't think it is possable to open the list by code, maybe you should use another control like a 'ListBox' and use the Click or DoubleClick events to trigger an action.

but as far as your ListView the property you are looking for is .EnsureVisible. This is an Item.Property.

here is an example of how to use it, you will find this property being used in the AddRow_Click() function.

Code:

;region Set Code Options
Dim $SO
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("Explicit", "ON")
;endregion

;region Setup Variables
Break On
Global $System,$Form,$Sender

Dim $nul,$ListView,$ItemColumnLbl,$ItemColumnTxtBox,$ColumnALbl,$ColumnATxtBox,$ColumnBLbl,$ColumnBTxtBox,
$AddRowBtn,$Item

$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles
;endregion

;region Form
$Form = $System.Form()
$Form.StartPosition = 1  ;FormStartPosition_CenterScreen
$Form.Size = $System.Size(470,238) ;(Width,Height)
$Form.Text = "Listview Example,..."

$ListView = $System.ListView()
$ListView.Dock = 2  ;Bottom
$ListView.Height = 134
$ListView.Name = "ListView"
$ListView.FullRowSelect  = -1
$ListView.View = $System.View_Details
$nul = $Form.Controls.Add($ListView)

$Item = $ListView.Columns.Add($System.ColumnHeader("Item Column",100,$System.HorizontalAlignment_Left))
$Item = $ListView.Columns.Add($System.ColumnHeader("Column A",100,$System.HorizontalAlignment_Center))
$Item = $ListView.Columns.Add($System.ColumnHeader("Column B",100,$System.HorizontalAlignment_Right))

$ItemColumnLbl = $System.Label()
$ItemColumnLbl.Left = 10
$ItemColumnLbl.Text = "Item Column:"
$ItemColumnLbl.TextAlign = 16  ;MiddleLeft
$ItemColumnLbl.Top = 10
$ItemColumnLbl.Width = 90
$nul = $Form.Controls.Add($ItemColumnLbl)

$ItemColumnTxtBox = $System.TextBox()
$ItemColumnTxtBox.TextChanged = "TextBox_TextChanged('ItemColumnTxtBox')"
$ItemColumnTxtBox.Left = 10
$ItemColumnTxtBox.Name = "ItemColumnTxtBox"
$ItemColumnTxtBox.Top = 40
$ItemColumnTxtBox.Width = 90
$nul = $Form.Controls.Add($ItemColumnTxtBox)

$ColumnALbl = $System.Label()
$ColumnALbl.Left = 110
$ColumnALbl.Text = "Column A:"
$ColumnALbl.TextAlign = 16  ;MiddleLeft
$ColumnALbl.Top = 10
$ColumnALbl.Width = 90
$nul = $Form.Controls.Add($ColumnALbl)

$ColumnATxtBox = $System.TextBox()
$ColumnATxtBox.Enabled = 0
$ColumnATxtBox.Left = 110
$ColumnATxtBox.Name = "ColumnATxtBox"
$ColumnATxtBox.TextChanged = "TextBox_TextChanged('ColumnATxtBox')"
$ColumnATxtBox.Top = 40
$ColumnATxtBox.Width = 90
$nul = $Form.Controls.Add($ColumnATxtBox)

$ColumnBLbl = $System.Label()
$ColumnBLbl.Left = 210
$ColumnBLbl.Text = "Column B:"
$ColumnBLbl.TextAlign = 16  ;MiddleLeft
$ColumnBLbl.Top = 10
$ColumnBLbl.Width = 90
$nul = $Form.Controls.Add($ColumnBLbl)

$ColumnBTxtBox = $System.TextBox()
$ColumnBTxtBox.Enabled = 0
$ColumnBTxtBox.Name = "ColumnBTxtBox"
$ColumnBTxtBox.Left = 210
$ColumnBTxtBox.TextChanged = "TextBox_TextChanged('ColumnBTxtBox')"
$ColumnBTxtBox.Top = 40
$ColumnBTxtBox.Width = 90
$nul = $Form.Controls.Add($ColumnBTxtBox)

$AddRowBtn = $System.Button()
$AddRowBtn.Click = "AddRow_Click()"
$AddRowBtn.Enabled = 0
$AddRowBtn.Left = 310
$AddRowBtn.Name = "AddRowBtn"
$AddRowBtn.Text = "Add"
$AddRowBtn.Top = 40
$nul = $Form.Controls.Add($AddRowBtn)

$Form.Show  ;Displays the Form

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

Function TextBox_TextChanged($Sender)
  Dim $ColumnATxtBox,$ColumnBTxtBox,$AddRowBtn
  $Sender = $Form.FindControl($Sender)
 
  Select
    Case $Sender.Name = "ItemColumnTxtBox"
      $ColumnATxtBox = $Form.FindControl("ColumnATxtBox")
      If Not ($Sender.Text = "")
        $ColumnATxtBox.Enabled = -1
      Else
        $ColumnATxtBox.Enabled = 0
      EndIf
    Case $Sender.Name = "ColumnATxtBox"
      $ColumnBTxtBox = $Form.FindControl("ColumnBTxtBox")
      If Not ($Sender.Text = "")
        $ColumnBTxtBox.Enabled = -1
      Else
        $ColumnBTxtBox.Enabled = 0
      EndIf
    Case $Sender.Name = "ColumnBTxtBox"
      $AddRowBtn = $Form.FindControl("AddRowBtn")
      If Not ($Sender.Text = "")
        $AddRowBtn.Enabled = -1
      Else
        $AddRowBtn.Enabled = 0
      EndIf
  EndSelect
EndFunction

Function AddRow_Click()
  Dim $ItemColumnTxtBox,$ColumnATxtBox,$ColumnBTxtBox,$AddRowBtn,$MsgBox,$ListView,$Item0,$Item1,$Item2
 
  $ListView = $Form.FindControl("ListView")
  $ItemColumnTxtBox = $Form.FindControl("ItemColumnTxtBox")
  $ColumnATxtBox = $Form.FindControl("ColumnATxtBox")
  $ColumnBTxtBox = $Form.FindControl("ColumnBTxtBox")
  $AddRowBtn = $Form.FindControl("AddRowBtn")
  If Not ($ItemColumnTxtBox.Text = "")
    If Not ($ColumnATxtBox.Text = "")
      If Not($ColumnBTxtBox.Text = "")
        $ListView.BeginUpdate
        $ListView.SelectedItems.Clear
        $Item0 = $ListView.Items.Add($System.ListViewItem($ItemColumnTxtBox.Text))
        $Item1 = $ListView.Items.Item($Item0.Index).SubItems.Add($System.ListViewSubItem($ColumnATxtBox.Text))
        $Item2 = $ListView.Items.Item($Item0.Index).SubItems.Add($System.ListViewSubItem($ColumnBTxtBox.Text))
        $ItemColumnTxtBox.Text = ""
        $ColumnATxtBox.Text = ""
        $ColumnBTxtBox.Text = ""
        $ColumnATxtBox.Enabled = 0
        $ColumnBTxtBox.Enabled = 0
        $AddRowBtn.Enabled = 0
        $Item0.Selected = -1
        $Item0.EnsureVisible
        $ListView.EndUpdate
      Else
        $MsgBox = MessageBox("The ColumnBTxtBox is blank, please update the TextBox","Error",16)
      EndIf
    Else
      $MsgBox = MessageBox("The ColumnATxtBox is blank, please update the TextBox","Error",16)
    EndIf
  Else
    $MsgBox = MessageBox("The ItemColumnTxtBox is blank, please update the TextBox","Error",16)
  EndIf
EndFunction

_________________
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
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Mon Jan 14, 2008 5:36 pm    Post subject: Reply with quote

benny saves the day Very Happy
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jan 14, 2008 10:51 pm    Post subject: Reply with quote

And in terms of the ComboBox dropping down, we have this:

ComboBox..::.DroppedDown Property

But funny enough, I'm not on my main computer right, can't remeber if this is already implemented in kf.net ... can anyone check (I dont think it is).
Back to top
View user's profile Send private message
AJ83
KiXforms Follower
KiXforms Follower


Joined: 14 Jun 2007
Posts: 16

PostPosted: Tue Jan 15, 2008 8:50 am    Post subject: Reply with quote

Tnx Benny! $rowname.EnsureVisible works fine!

And Shawn, it IS implemented, it works with
$combobox.DroppedDown = -1

Thank you all for thinking with me here Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
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