Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - [WORKAROUND] InplaceEdit Position
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[WORKAROUND] InplaceEdit Position

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: [WORKAROUND] InplaceEdit Position
    Posted: 19 May 2011 at 1:33am
If you set the height for a row in the MeasureRow event, and set the Alignment for a column to use VCenter, when you click to edit the item, the edit window no longer lines up vertically with the text - is there a way to set the vertical alignment of the InplaceEdit window?
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2011 at 10:41pm
Workaround:


Private Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_SHOWWINDOW As Long = &H40


Private Sub ReportControl1_BeginEdit(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
   ' Set the edit window position to match the text vertically aligned position
  
   Dim l_Left As Long, l_Top As Long, l_Right As Long, l_Bottom As Long
   Dim lo_OldFont As StdFont
   Dim l_TextHeight As Long
   Dim l_Offset As Long
     
   If Row Is Nothing Then Exit Sub
   If Item Is Nothing Then Exit Sub
   If Me.ReportControl1.InplaceEditHwnd = 0 Then Exit Sub
  
   ' Get the height of the font
   Set lo_OldFont = UserControl.Font
   Set Me.Font = Me.ReportControl1.PaintManager.TextFont
   l_TextHeight = Me.ScaleY(Me.TextHeight("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+-={}\[]|:"";'<>,.?/~`"), Me.ScaleMode, vbPixels)
   Set Me.Font = lo_OldFont
  
   ' Get the RECT of the Cell
   Row.GetItemRect Item, l_Left, l_Top, l_Right, l_Bottom
  
   ' Calculate the offset for the edit window
   l_Offset = Int((l_Bottom - l_Top) / 2 + 0.5) - Int((l_TextHeight / 2) + 0.5) - IIf((l_Bottom - l_Top) Mod 2 = 0, 1, 2)  ' Probably a better way to do this but it works for now across a range of row heights that I tested
  
   ' Add the offset to the TOP position, and subtract it from the HEIGHT of the edit window
   SetWindowPos Me.ReportControl1.InplaceEditHwnd, 0, l_Left + 2, l_Top + l_Offset, l_Right, l_Bottom - l_Offset, SWP_NOZORDER + SWP_SHOWWINDOW
End Sub

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.