Print Page | Close Window

SOLVED: Get text from xtpControlEdit in CommandBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=16557
Printed Date: 30 November 2024 at 1:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED: Get text from xtpControlEdit in CommandBar
Posted By: mstuart
Subject: SOLVED: Get text from xtpControlEdit in CommandBar
Date Posted: 06 April 2010 at 10:17pm
Hi all,
I'm new to the forum, and have been implementing/developing with the COM Suite 13.2.1 for a couple of months now.

My development tool for the past 18 years has been eDeveloper 9.4 by Magic Software. And recently we started using the Codejock COM Suite in our CRM product.

To learn the Codejock products, I installed VB6 and learned it from the Codejock samples, so that I could implement the Report Control into our software.
I got it working, but now am seeing the power of VB6 and Codejock combined and have started proto-typing certain parts of our software in VB6.

With that, I need all the help I can get, and have been searching on the forum quite a bit. Some thiing I have found answers for and some I have submitted to tech support.

But haven't found an answer to the following:
I need to capture the text value from an xtpControlEdit control that is loaded into a Commandbar.
For each key down, the CommandBarKeyDown event is 1 character behind in its handler.

Here's my VB6 code:

Private Sub CommandBars_CommandBarKeyDown(CommandBar As XtremeCommandBars.ICommandBar, KeyCode As Long, Shift As Integer)
    
    If KeyCode <> 0 Then
        Dim ControlEdit As CommandBarEdit
        Set ControlEdit = CommandBar.SelectedControl
        Debug.Print ControlEdit.Text
    End If
    
End Sub

Private Sub Form_Load()
    Dim bar As CommandBar
    
    Me.CommandBars.DeleteAll
    CommandBars.VisualTheme = xtpThemeOffice2003
    
    Set bar = Me.CommandBars.Add("Toolbar", xtpBarTop)
    bar.Controls.Add xtpControlButton, 1000, "Button 1"
    bar.Controls.Add xtpControlButton, 1001, "Button 2"
    bar.Controls.Add xtpControlEdit, 1002, "Search"
End Sub

I will be using the xtpControlEdit to filter a Report Control for each character typed by the user. Being 1 character behind in its value is not good, and would result with incorrect data.

Q: do I have the correct code, or is it that there is a change required?



-------------
Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9



Replies:
Posted By: mstuart
Date Posted: 07 April 2010 at 11:25am
bump - anybody have incite on this issue?

-------------
Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9


Posted By: Aaron
Date Posted: 07 April 2010 at 12:39pm
Hi,
 
You can also use:
 
Private Sub CommandBars_ControlNotify(ByVal Control As XtremeCommandBars.ICommandBarControl, ByVal Code As Long, ByVal NotifyData As Variant, Handled As Variant)
    Select Case Control.Id
        Case ID_TOOLBAR_SEARCH 'the ID of the CommandbarControl
            If Code = XTPControlNotify.XTP_EN_CHANGE Then  
                Me.wndReportControl.FilterText = Control.Text
                Me.wndReportControl.Populate
            End If
    End Select
End Sub
 
This event is fired everytime (in your case typing characters into CommandBarsEdit). The params are poorly documented so I had to findout myself. But it works and that what matters, right?
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: mstuart
Date Posted: 07 April 2010 at 4:06pm
Hi all,
I've placed into my VB6 application, the event handler you mentioned.
But there is no Control.Text for the Control object in the CommandBars_ControlNotify event.

I'm unable to get this working.
Can you help me on this please?


-------------
Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9


Posted By: gibra
Date Posted: 10 April 2010 at 10:22am
I use SuitePro v13.3.1
 
Control.Text property, really, doesn't appear using Intellisense, however it is there and work.
May be a BUG?
 
Dim ID_TOOLBAR_EDIT_SEARCH = 1002
 
Private Sub CommandBars_ControlNotify(ByVal Control As XtremeCommandBars.ICommandBarControl, ByVal Code As Long, ByVal NotifyData As Variant, Handled As Variant)
    If Control.Id = ID_TOOLBAR_EDIT_SEARCH Then
        Debug.Print ctrlEditSearch.Text
    End If
End Sub
 
 


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: Aaron
Date Posted: 11 April 2010 at 1:58am
Originally posted by mstuart mstuart wrote:

Hi all,
I've placed into my VB6 application, the event handler you mentioned.
But there is no Control.Text for the Control object in the CommandBars_ControlNotify event.

I'm unable to get this working.
Can you help me on this please?
 
 
Hi,
 
I know it doesn't show but it's really there  Just use the code I mentioned and it will work (at least with VB)
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: mstuart
Date Posted: 12 April 2010 at 11:35am
Hi,
I typed in the Control.Edit code and it didn't error at that time. But when I run the program and type into the commandbar edit control, it returns the error:
Run-time error '438':
Object doesn't support this property or method

I'm using Codejock Suite v13.2.1

I'll build a demo program that demonstrates this commandbar edit control and report control, and return with my findings.

Here's my handler code:
Private Sub ACommandBars_ControlNotify(ByVal Control As XtremeCommandBars.ICommandBarControl, ByVal Code As Long, ByVal NotifyData As Variant, Handled As Variant)
    Select Case Control.Id
        Case 4 'this is the edit control's id
            If Code = XTPControlNotify.XTP_EN_CHANGE Then
               Me.AReportControl.FilterText = Control.Edit
               Me.AReportControl.Populate
            End If
    End Select
End Sub

Findings:
VB6 continues to report the above error with the code "Control.Edit".

Anybody have a solution to this issue: as the user types each character into a CommandBars ControlEdit control, it filter the report control.


-------------
Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9


Posted By: SuperMario
Date Posted: 12 April 2010 at 4:53pm
They said Control.Text not Control.Edit.

Or if you really want, just cast it??

            If Code = XTPControlNotify.XTP_EN_CHANGE Then
               Dim x As CommandBarEdit
               Set x = Control
               Debug.Print x.Text
            End If


Posted By: mstuart
Date Posted: 12 April 2010 at 4:59pm
Hi SuperMario,
My bad. I guess I meant to type Control.Text.
I changed it and now it is working.

-------------
Regards,
Mark Stuart

Product: Xtreme SuitePro (ActiveX) v13.2.1
Platform: WinXP (32bit)/Win7 (64bit)
Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net