<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : How to SetFocus to a ComboBox?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : How to SetFocus to a ComboBox?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 13 Jun 2026 18:20:52 +0000</pubDate>
  <lastBuildDate>Tue, 15 Feb 2011 03:54:49 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=17845</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : Thank you, this will work. :-) ...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62639&amp;title=how-to-setfocus-to-a-combobox#62639</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1570">Jebo</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 15 February 2011 at 3:54am<br /><br />Thank you, this will work. :-)]]>
   </description>
   <pubDate>Tue, 15 Feb 2011 03:54:49 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62639&amp;title=how-to-setfocus-to-a-combobox#62639</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : btw maybe such code will work...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62638&amp;title=how-to-setfocus-to-a-combobox#62638</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 15 February 2011 at 3:38am<br /><br />btw maybe such code will work for you. there is&nbsp;SetPopupToolBar&nbsp;method that make context menu looks like minibar:<div><br></div><div><div>Option Explicit</div><div><br></div><div>Public oCmdBar As CommandBar</div><div><br></div><div>Private Declare Function apiSetFocus Lib "user32.dll" Alias "SetFocus" (ByVal hwnd As Long) As Long</div><div>Private Declare Function apiGetFocus Lib "user32.dll" Alias "GetFocus" () As Long</div><div><br></div><div>Private mo_MiniToolbar As XtremeCommandBars.MiniToolBar</div><div>Private mo_Combo As XtremeCommandBars.CommandBarComboBox</div><div><br></div><div>Private Sub Command1_Click()</div><div>&nbsp;&nbsp; &nbsp;oCmdBar.ShowPopup , 5000, 5000</div><div>End Sub</div><div><br></div><div>Private Sub CommandBars1_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)</div><div>&nbsp;&nbsp; If Control Is mo_Combo Then</div><div>&nbsp;&nbsp; &nbsp; &nbsp;If Control.Visible Then</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; If apiGetFocus &lt;&gt; mo_Combo.EditHandle Then</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Debug.Print "Setting Focus " &amp; Timer</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'apiSetFocus mo_Combo.EditHandle</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mo_Combo.Execute ' Set focus for Combo</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; End If</div><div>&nbsp;&nbsp; &nbsp; &nbsp;End If</div><div>&nbsp;&nbsp; End If</div><div>End Sub</div><div><br></div><div>Private Sub Form_Load()</div><div>With CommandBars1</div><div>&nbsp;&nbsp; &nbsp;Set oCmdBar = .ContextMenus.Add(1, "Test1")</div><div>&nbsp;&nbsp; &nbsp;With oCmdBar</div><div>&nbsp;&nbsp; &nbsp; &nbsp; Set mo_Combo = .Controls.Add(xtpControlComboBox, 100, "Test")</div><div>&nbsp;&nbsp; &nbsp; &nbsp; With mo_Combo</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.DropDownListStyle = True</div><div>&nbsp;&nbsp; &nbsp; &nbsp; End With</div><div>&nbsp;&nbsp; &nbsp;End With</div><div>&nbsp;&nbsp; &nbsp;oCmdBar.Controls.Add xtpControlButton, 1, "Test1"</div><div>&nbsp;&nbsp; &nbsp;</div><div><b>&nbsp;&nbsp; &nbsp;oCmdBar.SetPopupToolBar True</b></div><div>&nbsp;&nbsp; &nbsp;oCmdBar.Width = 400</div><div>End With</div><div><br></div><div>End Sub</div></div><div><br></div>]]>
   </description>
   <pubDate>Tue, 15 Feb 2011 03:38:31 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62638&amp;title=how-to-setfocus-to-a-combobox#62638</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? :   I have tried to open a second...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62515&amp;title=how-to-setfocus-to-a-combobox#62515</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1570">Jebo</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 09 February 2011 at 4:21pm<br /><br />I have tried to open a second MiniToolbar without a part of a popup. But now I have another problem - it is not possible to set it on a individual screen-position. <img src="http://forum.codejock.com/smileys/smiley11.gif" border="0" alt="Dead" title="Dead" /><br><br><b>mo_MiniToolbar.PopupMiniToolBar , 1500,1500</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">&lt;&lt;&lt; ist NOT POSSBILE!</font> <img src="http://forum.codejock.com/smileys/smiley18.gif" border="0" alt="Ouch" title="Ouch" /><br><br>...I think it's because the MiniToolbar fades if it is not in the near of the mouse pointer. Is there any way to show a <b>MiniToolBar </b>on a individual screen-position?]]>
   </description>
   <pubDate>Wed, 09 Feb 2011 16:21:29 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62515&amp;title=how-to-setfocus-to-a-combobox#62515</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : &amp;gt; If so, you will probably...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62509&amp;title=how-to-setfocus-to-a-combobox#62509</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1570">Jebo</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 09 February 2011 at 3:15pm<br /><br />&gt; If so, you will probably have to open a support ticket for this.<br>Yes, already done now... Hope, they can help me.<br><br>]]>
   </description>
   <pubDate>Wed, 09 Feb 2011 15:15:15 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62509&amp;title=how-to-setfocus-to-a-combobox#62509</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : I think the problem is that the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62505&amp;title=how-to-setfocus-to-a-combobox#62505</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 09 February 2011 at 2:39pm<br /><br />I think the problem is that the oCmdBar part of the popup is eating the keyboard presses to see if it should execute one of the menu items. In your example, if you type <b>T </b>it will exexute the Test1 control. Any other keypress will do nothing (since there are no matching captions to execute.<br><br>What exactly do you need to accomplish? You want a ComboBox with focus, and a menu beneath it that doesn't accept accelerator key presses (that is, all keypresses go to the combobox, but the menu below remains visible)? If so, you will probably have to open a support ticket for this.<br>]]>
   </description>
   <pubDate>Wed, 09 Feb 2011 14:39:38 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62505&amp;title=how-to-setfocus-to-a-combobox#62505</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : Thank you, but it still not work...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62497&amp;title=how-to-setfocus-to-a-combobox#62497</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1570">Jebo</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 09 February 2011 at 1:13pm<br /><br />Thank you, but it still not work with Mini-Toolbars!<br><br>Here is my complete code. So you can see it doesn't work! <img src="http://forum.codejock.com/smileys/smiley18.gif" border="0" alt="Ouch" title="Ouch" /><br><font size="2"><br>Option Explicit<br><br>Public oCmdBar As CommandBar<br><br>Private Declare Function apiSetFocus Lib "user32.dll" Alias "SetFocus" (ByVal hwnd As Long) As Long<br>Private Declare Function apiGetFocus Lib "user32.dll" Alias "GetFocus" () As Long<br><br>Private mo_MiniToolbar As XtremeCommandBars.MiniToolBar<br>Private mo_Combo As XtremeCommandBars.CommandBarComboBox<br><br>Private Sub Command1_Click()<br>&nbsp;&nbsp;&nbsp; mo_MiniToolbar.PopupContextMenu oCmdBar<br>End Sub<br><br>Private Sub CommandBars1_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)<br>&nbsp;&nbsp; If Control Is mo_Combo Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Control.Visible Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If apiGetFocus &lt;&gt; mo_Combo.EditHandle Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print "Setting Focus " &amp; Timer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; apiSetFocus mo_Combo.EditHandle<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp; End If<br>End Sub<br><br>Private Sub Form_Load()<br>With CommandBars1<br>&nbsp;&nbsp;&nbsp; Set oCmdBar = .ContextMenus.Add(1, "Test1")<br>&nbsp;&nbsp;&nbsp; .ContextMenus.AddPopup mo_MiniToolbar<br>&nbsp;&nbsp;&nbsp; Set mo_MiniToolbar = .AddMiniToolBar("Test2")<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; With mo_MiniToolbar<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set mo_Combo = .Controls.Add(xtpControlComboBox, 100, "Test")<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With mo_Combo<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .DropDownListStyle = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp;&nbsp; End With<br>End With<br><br>oCmdBar.Controls.Add xtpControlButton, 1, "Test1"<br>End Sub</font><br><br><br><br>]]>
   </description>
   <pubDate>Wed, 09 Feb 2011 13:13:14 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62497&amp;title=how-to-setfocus-to-a-combobox#62497</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : This appears to work okay, but...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62464&amp;title=how-to-setfocus-to-a-combobox#62464</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 08 February 2011 at 10:35pm<br /><br />This appears to work okay, but you lose the fade in of the MiniToolbar:<br><br><table width="99%"><tr><td><pre class="BBcode"><br>Option Explicit<br><br>Private Declare Function apiSetFocus Lib "user32.dll" Alias "SetFocus" (ByVal hwnd As Long) As Long<br>Private Declare Function apiGetFocus Lib "user32.dll" Alias "GetFocus" () As Long<br><br>Private mo_MiniToolbar As XtremeCommandBars.MiniToolBar<br>Private mo_Combo As XtremeCommandBars.CommandBarComboBox<br><br>Private Sub Command1_Click()<br>&nbsp;&nbsp; mo_MiniToolbar.PopupMiniToolBar<br>End Sub<br><br>Private Sub CommandBars1_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)<br>&nbsp;&nbsp; If Control Is mo_Combo Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Control.Visible Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If apiGetFocus &lt;&gt; mo_Combo.EditHandle Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print "Setting Focus " &amp; Timer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; apiSetFocus mo_Combo.EditHandle<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp; End If<br>End Sub<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp; With Me.CommandBars1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set mo_MiniToolbar = .AddMiniToolBar("Test")<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With mo_MiniToolbar<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set mo_Combo = .Controls.Add(xtpControlComboBox, 100, "Test")<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With mo_Combo<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .DropDownListStyle = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp; End With<br>End Sub<br></pre></td></tr></table><br>]]>
   </description>
   <pubDate>Tue, 08 Feb 2011 22:35:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62464&amp;title=how-to-setfocus-to-a-combobox#62464</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : I didn&amp;#039;t try it with the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62463&amp;title=how-to-setfocus-to-a-combobox#62463</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 08 February 2011 at 10:24pm<br /><br />I didn't try it with the Minibar - maybe that's the problem? I will see if I can find a workaround and get back to you.]]>
   </description>
   <pubDate>Tue, 08 Feb 2011 22:24:30 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62463&amp;title=how-to-setfocus-to-a-combobox#62463</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : Thanks, but I had tested already...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62462&amp;title=how-to-setfocus-to-a-combobox#62462</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1570">Jebo</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 08 February 2011 at 9:29pm<br /><br /><div dir="ltr" id="Translati&#111;nOutput" ="mt"><div><span lang="en">Thanks, but I had tested already with SetFocus-API. </span><span lang="en">But it doesn't work!</span> <img src="http://forum.codejock.com/smileys/smiley21.gif" border="0" alt="Thumbs Down" title="Thumbs Down" /><br></div></div>The Cursor is blinking in the ComboBox. But if I press any key, nothing happens!&nbsp;<img src="http://forum.codejock.com/smileys/smiley18.gif" border="0" alt="Ouch" title="Ouch" /><br><br>BTW: I use an commandBar-ContextMenu AND a MiniBar. The ComboBox is a part of the MiniBar!!!<br>]]>
   </description>
   <pubDate>Tue, 08 Feb 2011 21:29:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62462&amp;title=how-to-setfocus-to-a-combobox#62462</guid>
  </item> 
  <item>
   <title><![CDATA[How to SetFocus to a ComboBox? : Looks like the ComboBox isn&amp;#039;t...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62459&amp;title=how-to-setfocus-to-a-combobox#62459</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17845<br /><strong>Posted:</strong> 08 February 2011 at 4:22pm<br /><br />Looks like the ComboBox isn't properly forwarding the focus to the edit window of the control (notice if you start typing, it works but misses the first character that you typed).<br><br>It looks like using the SetFocus API on the edit handle works though:<br><br><table width="99%"><tr><td><pre class="BBcode"><br>Option Explicit<br><br>Private Declare Function apiSetFocus Lib "user32.dll" Alias "SetFocus" (ByVal hwnd As Long) As Long<br><br>Private mo_Combo As XtremeCommandBars.CommandBarComboBox<br><br>Private Sub Command1_Click()<br>&nbsp;&nbsp; apiSetFocus mo_Combo.EditHandle<br>End Sub<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp; With Me.CommandBars1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With .AddMenuBar("Test")<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set mo_Combo = .Controls.Add(xtpControlComboBox, 100, "Test")<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With mo_Combo<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mo_Combo.DropDownListStyle = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp; End With<br>End Sub<br></pre></td></tr></table><br>]]>
   </description>
   <pubDate>Tue, 08 Feb 2011 16:22:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17845&amp;PID=62459&amp;title=how-to-setfocus-to-a-combobox#62459</guid>
  </item> 
 </channel>
</rss>