Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - TIP: Editcontrol setfocus
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TIP: Editcontrol setfocus

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

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post Topic: TIP: Editcontrol setfocus
    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
Back to Top
Mr.Den View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2007
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mr.Den Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
joeliner View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Mr.Den View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2007
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mr.Den Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
joeliner View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
ManSys View Drop Down
Newbie
Newbie


Joined: 02 February 2010
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote ManSys Quote  Post ReplyReply Direct Link To This Post 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
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.188 seconds.