Print Page | Close Window

TIP: Editcontrol setfocus

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=15244
Printed Date: 06 October 2024 at 12:21pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TIP: Editcontrol setfocus
Posted By: joeliner
Subject: TIP: Editcontrol setfocus
Date Posted: 25 September 2009 at 6:14am

Hi guys,

i wonder why it doesn't work out of the box but when you set editcontrol.setfocus you actually dont see the cursor blinking inside the editcontrol. Now you may not really want to execute but first allow the user to type some txt then execute. So after struggling with it for ages, this what i did:
 
Dim controlEdit as CommandBarEdit
Set controlEdit = Commandbars.FindControl(, ID_FIND_RECORD)
controlEdit.Setfocus
Sendkeys "{Enter}"
 
am sure this is something CJ can add in their code in future.
 
regards,
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 13.1
Platform: Windows XP SP 3
Language: Visual Basic 6 SP6



Replies:
Posted By: Mr.Den
Date Posted: 25 September 2009 at 11:59am
You can accomplish the same thing with the .Execute command:
 
Commandbars.FindControl(, ID_FIND_RECORD).Execute
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 16.3.1

Platform: Windows 7 Professional (64bit) - SP 1

Language: Visual Basic 6.0 SP 6


Posted By: joeliner
Date Posted: 25 September 2009 at 12:15pm
Hi Mr. Den,

Am afraid not cause i have tried .execute countless times. The scenario is like that of the new windows Mail.

You press Ctrl + E (which in our case can be a commandbarAction - ID_FIND_RECORD) and the cursor gets the focus on to the editcontrol. The user types
some text e.g. 'code' and presses enter then the Execute command is executed.

Get what I mean?



-------------
Product: Xtreme SuitePro (ActiveX) version 13.1
Platform: Windows XP SP 3
Language: Visual Basic 6 SP6


Posted By: Mr.Den
Date Posted: 28 September 2009 at 11:17am
I just tried this in a sample app and it worked with an edit field and an exit button:
 
Private Sub CommandBars_CommandBarKeyDown(CommandBar As XtremeCommandBars.ICommandBar, KeyCode As Long, Shift As Integer)
 
    Select Case KeyCode
        Case 13
            CommandBars.FindControl(, ID_PB_EXIT).Execute
           
    End Select
   
End Sub
 
As soon as I pressed the enter key, the exit button fires. Is that what you mean?


-------------
Product: Xtreme SuitePro (ActiveX) version 16.3.1

Platform: Windows 7 Professional (64bit) - SP 1

Language: Visual Basic 6.0 SP 6


Posted By: joeliner
Date Posted: 29 September 2009 at 1:23am
Your right Mr. Den,

That scenario will work where the commandbars and editcontrol is on the same form or same App. My fault, I should have mentioned this, In my production enviroment, my form that has the editcontrol is in a dll and attached to a dockingpane. the commandbars on a main form.

regards




-------------
Product: Xtreme SuitePro (ActiveX) version 13.1
Platform: Windows XP SP 3
Language: Visual Basic 6 SP6


Posted By: ManSys
Date Posted: 02 February 2010 at 4:42am
This is causing me no end of grief - you can't even put a Custom Control on the form and set focus to that - no cursor is shown!  My form is opened by a PopupControl held on another form and when the SendKeys is called it sends Codejock into a loop and crashes the app / vb.  Very disappointing!

-------------
-
ManSys Limited



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