VB6 SCGrid Textbox -


within vb6 form, i'm using scgrid object cells editable means of textbox.

i suppose grid control creates textbox object user clicks cell.

i need reference textbox.

in particular, when user presses [left] or [right] key, need current position of cursor within textbox. can call textbox.selstart.

does know how control used when editing cell?

i figured out myself:

' declaration needed getting current position of cursor private type point   x long   y long end type  private declare function getcaretpos lib "user32" (byref lppoint point) long  ' function returns position of cursor within cell being edited textbox ' value expressed number of characters preceeding position private function getcaretposition() integer    ' variables   dim position point   dim result   long   dim contents string    ' position   result = getcaretpos(position)    ' convert number of characters   ' figured out factor 15 trial , error   ' don't know comes seems independent of font size   contents = mygrid.text(row_gvar, column_gvar)   result = 0   while ((result < len(contents)) , _          (position.x > (grid_gvar.parent.textwidth(left(contents, result)) / 15)))     result = result + 1   wend    ' done   getcaretposition = result  end function 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -