Prev: Calling VB pgm from DOS, thence exiting to DOS after a CHDIR
Next: Read META-tags from web browser control
From: David on 13 Apr 2010 13:45 I use both a textbox and several combos on my MSFlexgrid for Adding or Editing the grid. When I'm in "Add or Edit" mode and scroll the grid the position of the textbox and combos does NOT stay with the row being edited or added. I've tried the following, but when "Add or Edit" mode is entered the Scroll bar event seems to get in an infinite loop. Any idea how to trap the Scroll event (this triggers for both horizontal and vertical scroll) to allow the textbox and combos to either track the row of interest or shut them off so they are not visible if the row is not visible??? Private Sub MSFlexGrid1_Scroll() Select Case miEditMode Case EDIT_EDIT, EDIT_ADD With MSFlexGrid1 If .RowsVisible(miSaveRow) Then ' '= False Then .TopRow = .Row Call SetEditControls(True) Else Call SetEditControls(False) End If End With Case Else End Select End Sub
From: David on 13 Apr 2010 14:01 Please note code line should read: If .RowIsVisible(miSaveRow) Then "David" <NoWhere(a)earthlink.net> wrote in message news:OBrmoEz2KHA.1624(a)TK2MSFTNGP06.phx.gbl... >I use both a textbox and several combos on my MSFlexgrid for > Adding or Editing the grid. When I'm in "Add or Edit" mode > and scroll the grid the position of the textbox and combos does NOT stay > with the row being edited or added. I've tried the following, but when > "Add or Edit" mode is entered the Scroll bar event seems to > get in an infinite loop. Any idea how to trap the Scroll event (this > triggers for both horizontal and vertical scroll) to allow the textbox > and combos to either track the row of interest or shut them off so they > are > not visible if the row is not visible??? > > Private Sub MSFlexGrid1_Scroll() > > Select Case miEditMode > > Case EDIT_EDIT, EDIT_ADD > With MSFlexGrid1 > If .RowsVisible(miSaveRow) Then > ' '= False Then .TopRow = .Row > Call SetEditControls(True) > Else > Call SetEditControls(False) > End If > End With > Case Else > > End Select > > > End Sub >
From: Phil Hunt on 13 Apr 2010 15:42 what you show is not enough. maybe your setEditControls mug around with the row or column index which will trigger scroll event again. BTW, RowsIsVisible is not very reliable. I have the same program running on different PC, one work one does not. Didi you try using the click event, it gives you the row / column index to work with. "David" <NoWhere(a)earthlink.net> wrote in message news:OBrmoEz2KHA.1624(a)TK2MSFTNGP06.phx.gbl... >I use both a textbox and several combos on my MSFlexgrid for > Adding or Editing the grid. When I'm in "Add or Edit" mode > and scroll the grid the position of the textbox and combos does NOT stay > with the row being edited or added. I've tried the following, but when > "Add or Edit" mode is entered the Scroll bar event seems to > get in an infinite loop. Any idea how to trap the Scroll event (this > triggers for both horizontal and vertical scroll) to allow the textbox > and combos to either track the row of interest or shut them off so they > are > not visible if the row is not visible??? > > Private Sub MSFlexGrid1_Scroll() > > Select Case miEditMode > > Case EDIT_EDIT, EDIT_ADD > With MSFlexGrid1 > If .RowsVisible(miSaveRow) Then > ' '= False Then .TopRow = .Row > Call SetEditControls(True) > Else > Call SetEditControls(False) > End If > End With > Case Else > > End Select > > > End Sub >
From: David on 13 Apr 2010 19:17 Mr. Hunt: Thanks for responding. You'll need to enlighten me a little further. The _Click event does Not trigger when Scrolling. I use the _Click to obtain the row of interest when I go into "EDIT or "ADD" mode. However as indicated --- with my scroll code -- the scroll event for some reason goes into a loop. All SetEditControls does is Position the various controls (it does use .Row with .TextMatrix however) and toggles the visibility of the various controls. Hence the select case in the scroll event. I'm using >> If .RowsIsVisible(miSaveRow) Then to check whether the row being "Edited" is on or off the screen to know whether the controls needed to positioned while scrolling. "Phil Hunt" <aaa(a)aaa.com> wrote in message news:OToS4F02KHA.4752(a)TK2MSFTNGP02.phx.gbl... > what you show is not enough. maybe your setEditControls mug around with > the row or column index which will trigger scroll event again. BTW, > RowsIsVisible is not very reliable. I have the same program running on > different PC, one work one does not. > Didi you try using the click event, it gives you the row / column index to > work with. > > "David" <NoWhere(a)earthlink.net> wrote in message > news:OBrmoEz2KHA.1624(a)TK2MSFTNGP06.phx.gbl... >>I use both a textbox and several combos on my MSFlexgrid for >> Adding or Editing the grid. When I'm in "Add or Edit" mode >> and scroll the grid the position of the textbox and combos does NOT stay >> with the row being edited or added. I've tried the following, but when >> "Add or Edit" mode is entered the Scroll bar event seems to >> get in an infinite loop. Any idea how to trap the Scroll event (this >> triggers for both horizontal and vertical scroll) to allow the textbox >> and combos to either track the row of interest or shut them off so they >> are >> not visible if the row is not visible??? >> >> Private Sub MSFlexGrid1_Scroll() >> >> Select Case miEditMode >> >> Case EDIT_EDIT, EDIT_ADD >> With MSFlexGrid1 >> If .RowsVisible(miSaveRow) Then >> ' '= False Then .TopRow = .Row >> Call SetEditControls(True) >> Else >> Call SetEditControls(False) >> End If >> End With >> Case Else >> >> End Select >> >> >> End Sub >> > >
From: Phil Hunt on 13 Apr 2010 19:26
Can't you have code in click event to position your control ? "David" <NoWhere(a)earthlink.net> wrote in message news:OvUl$912KHA.3652(a)TK2MSFTNGP02.phx.gbl... > Mr. Hunt: > > Thanks for responding. > You'll need to enlighten me a little further. > > The _Click event does Not trigger when Scrolling. > I use the _Click to obtain the row of interest when I go into "EDIT or > "ADD" mode. > However as indicated --- with my scroll code -- the scroll event for some > reason goes into a loop. > > All SetEditControls does is Position the various controls (it does use > .Row with .TextMatrix however) and toggles the visibility of the various > controls. Hence the select case in the scroll event. I'm using > >>> If .RowsIsVisible(miSaveRow) Then > > to check whether the row being "Edited" is on or off the screen to know > whether the controls needed to positioned while scrolling. > > > > > "Phil Hunt" <aaa(a)aaa.com> wrote in message > news:OToS4F02KHA.4752(a)TK2MSFTNGP02.phx.gbl... >> what you show is not enough. maybe your setEditControls mug around with >> the row or column index which will trigger scroll event again. BTW, >> RowsIsVisible is not very reliable. I have the same program running on >> different PC, one work one does not. >> Didi you try using the click event, it gives you the row / column index >> to work with. >> >> "David" <NoWhere(a)earthlink.net> wrote in message >> news:OBrmoEz2KHA.1624(a)TK2MSFTNGP06.phx.gbl... >>>I use both a textbox and several combos on my MSFlexgrid for >>> Adding or Editing the grid. When I'm in "Add or Edit" mode >>> and scroll the grid the position of the textbox and combos does NOT stay >>> with the row being edited or added. I've tried the following, but when >>> "Add or Edit" mode is entered the Scroll bar event seems to >>> get in an infinite loop. Any idea how to trap the Scroll event (this >>> triggers for both horizontal and vertical scroll) to allow the textbox >>> and combos to either track the row of interest or shut them off so they >>> are >>> not visible if the row is not visible??? >>> >>> Private Sub MSFlexGrid1_Scroll() >>> >>> Select Case miEditMode >>> >>> Case EDIT_EDIT, EDIT_ADD >>> With MSFlexGrid1 >>> If .RowsVisible(miSaveRow) Then >>> ' '= False Then .TopRow = .Row >>> Call SetEditControls(True) >>> Else >>> Call SetEditControls(False) >>> End If >>> End With >>> Case Else >>> >>> End Select >>> >>> >>> End Sub >>> >> >> > > |