{"id":792,"date":"2009-06-10T21:59:34","date_gmt":"2009-06-10T21:59:34","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=792"},"modified":"2009-06-11T09:17:49","modified_gmt":"2009-06-11T09:17:49","slug":"improvements-to-twittoday","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=792","title":{"rendered":"Improvements to TwitToday"},"content":{"rendered":"<p>I&#8217;ve been doing too much Java at work recently, so in the interest of keeping my hand in with some low-level C++, I picked up the code for my <a href=\"http:\/\/dalelane.co.uk\/page.php?id=1047\">mobile twitter client, TwitToday<\/a>, again. <\/p>\n<p>I originally <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=244\">wrote it at a hackday<\/a>, but I&#8217;ve since come back to tweak it a couple of times to get it to <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=287\">spawn background worker threads<\/a>, <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=287\">add SIP on-screen keyboard support<\/a>, and <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=311\">improve support for sending special and accented characters<\/a>.<\/p>\n<p>After another evening of tweaking, I&#8217;ve added a few new minor features:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090610-twittoday1.jpg\" align=\"left\" hspace=\"10\" vspace=\"10\"\/><strong>Transparent text box<\/strong><\/p>\n<p>When not in use, the text box is now transparent. When it has focus, it is coloured in white as usual.<\/p>\n<p>A few people commented that a bright white text box could dominate a dark Today screen too much, so this is hopefully a nice aesthetic improvement.<\/p>\n<p>I did this by creating a custom <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa383738(VS.85).aspx\" target=\"_blank\">windows procedure<\/a> for the text box. <\/p>\n<p>The windows procedure needed to handle a couple of events: <\/p>\n<p>Handling <code>WM_PAINT<\/code> by using <code>SetBkMode<\/code> to make the text box <code>TRANSPARENT<\/code> <\/p>\n<p>Handling <code>WM_ERASEBKGND<\/code> by using <code>TODAYM_DRAWWATERMARK<\/code> to draw the background over the text control&#8217;s rectangle.<\/p>\n<p><!--more--><img decoding=\"async\" src=\"http:\/\/i267.photobucket.com\/albums\/ii311\/dale_lane\/090610-twittoday2.gif\" align=\"right\" hspace=\"10\" vspace=\"10\"\/><strong>Keyboard navigation<\/strong><\/p>\n<p>You used to need to tap inside the text box to use it. <\/p>\n<p>Now, you can use the phone&#8217;s D-Pad to scroll up or down to the TwitToday text box. <\/p>\n<p>When the TwitToday line is selected, the focus is set to the text box so that it is ready for you to start typing. <\/p>\n<p>I did this by altering the value of the Today Screen item&#8217;s <code>Selectability<\/code> registry key to &#8216;2&#8217;. <\/p>\n<p>I then used a custom <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa383738(VS.85).aspx\" target=\"_blank\">windows procedure<\/a> for the Today Screen window to capture <code>WM_TODAYCUSTOM_RECEIVEDSELECTION<\/code> events. At which point, I use <code>SetFocus<\/code> to set the focus to the text box.<\/p>\n<p>I added a separate custom windows procedure for the text control itself, and when selected, capturing <code>WM_KEYDOWN<\/code> events to look for <code>VK_TUP<\/code> and <code>VK_TDOWN<\/code> keys &#8211; at which point I deselect the Today screen item and allow the selection to pass to the Today Screen items above or below me.<\/p>\n<p><strong>&#8216;Enter&#8217; to send<\/strong><\/p>\n<p>You used to need to tap the &#8216;OK&#8217; button on the screen to send a tweet. <\/p>\n<p>Now, pressing &#8216;Enter&#8217; moves the focus to the &#8216;OK&#8217; button for you &#8211; from where pressing &#8216;Enter&#8217; again will send the tweet.<\/p>\n<p>I did this by using the custom windows procedure for the text control itself, capturing <code>WM_KEYDOWN<\/code> events to look for <code>VK_TACTION<\/code> at which point I use <code>SetFocus<\/code> to move the focus to the OK button.<\/p>\n<p>.<\/p>\n<p>And that&#8217;s it. <a href=\"http:\/\/dalelane.co.uk\/files\/TwitToday.CAB\">Download it here<\/a>. It makes the client a little less obtrusive, and saves you having to get out the stylus to use it. Minor tweaks, but they do improve the usability quite a bit.   <\/p>\n<p>Unfortunately, I never got around to doing anything clever around notifying users of updates, so most people who use my Twitter client will never know that I&#8217;ve made these changes. Whoops \ud83d\ude42 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been doing too much Java at work recently, so in the interest of keeping my hand in with some low-level C++, I picked up the code for my mobile twitter client, TwitToday, again. I originally wrote it at a hackday, but I&#8217;ve since come back to tweak it a couple of times to get [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[46,151,243,397,19],"class_list":["post-792","post","type-post","status-publish","format-standard","hentry","category-code","tag-mobile","tag-twitter","tag-twittoday","tag-win32","tag-windows-mobile"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=792"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}