• CSS to Show Cursor as a Pointer for a div or span Tag

    I don’t claim to be a CSS guru, so I have a true respect for those who are.

    I really prefer the programming more than the style, but a good, healthy knowledge of CSS certainly helps me add more style and class to my websites.

    I finally figured out how to do something that’s been causing me a headache lately and I thought I would share it with you. I’m sure this is common knowledge to CSS gurus, but it wasn’t to me.

    My problem was that often I needed to click on something in my pages to trigger a javascript or ajax call, but I didn’t want to click on an anchor tag because it would also trigger the href in the tag to be called. I could use the ‘#’ in my href, but that still made my page jump to the top. I could also use the ‘#something’ and give my anchor tags names so that it acted more like a bookmark. But, it still made the page jump around.

    I could use a <div> tag or <span> tag, but then my cursor wouldn’t change to the little hand with the pointing finger or whatever browsers use to indicate to the user that this is something that can and should be clicked on. Many times in the past I’ve resorted to the bookmarks and just lived with the jumping pages.

    But, the other day, I found this little bit of CSS code that has made it work perfectly:

    <div id="trigger" style="cursor: pointer"><b>click here</b></div>

    You can see below how this looks. I don’t have any javascript code hooked to this id, but it will give you an idea of how the cursor changes when you hover over the div.

    click here

    Here is the same line of code without the style attribute:

    click here

    Adding that style attribute to my <div> or <span> tags makes my cursor change to a little hand with a pointing finger (in my firefox browser) and doesn’t make the page jump around when I click on the link. My javascript can now work without the page ever flickering!

     
  • Objective-C

    My first taste of Objective-C has been an enjoyable one. At first glance, Objective-C looked like it was going to be more difficult and a big learning curve. But, as it turns out, once I understand the differences in syntax, it’s really not much different from c++ – at least so far.

    I now understand that I can send ‘messages’ to classes and to objects by placing square brackets ([]) around the message. These message trigger methods on the class or object. The method can be passed parameters (or arguments) and can return values, objects, or pointers.

    I like the fact that Objective-C includes the selector or method name in the message so that it’s easier to see what the values I’m passing to the method are used for. I think it makes it clearer as to what the method does and what I need to pass to the method.

    Now that I’ve got a fairly good understanding of Xcode and Objective-C syntax, I’m ready to move on to my next project!

     
  • Xcode

    As I mentioned on my other blog, my friend who works at Apple recommended that I start with Aaron Hillegass’ book, ‘COCOA Programming for Mac OS X’. And so I am.

    I’ve only gotten through a couple of pages, but so far this book is really working for me. I’ve been programming a long time, but never for Mac products. Mostly for Mainframe, DOS, and Windows early in my career and then with Linux and web development languages such as php, mysql, ajax and javascript. So, COCOA and Objective-C are similar but definitely different.

    Xcode is really cool. It provides me all the tools I need as a developer. And anything that isn’t included with Xcode is somewhere in the developer directory on my hard drive. It all came with my Snow Leopard DVD. If you don’t have Snow Leopard, it’s probably on your older version Mac OS X CD or DVD.

    Once installed, I have a /Developer folder in my root. Inside that folder is an applications folder – /Developer/Application – where I found Xcode.

    Random Number Generator

    Random Number Generator

    Today, in less than an hour, I finished building a random number generator App for my Mac. It’s very basic, but it’s a complete app. I only had to add a couple of lines of code to make a complete application complete with basic menu bar and items. And it works!! Pretty cool!

    I think I’m going to like this!

     
  • Change of Plans

    This blog is only a couple of days old and already I’m changing my plans.

    I had hoped to start at what I think is the beginning instead of jumping into something fairly complicated, but I REALLY need to go ahead and bite the bullet and learn more iPhone programming. So, instead of spending my time writing about Logic, I’m going to jump head first into COCOA programming and write about what I learn here.

    As soon as I work my way through the COCOA stuff, I’ll jump into Objective C and iPhone programming.

    Hopefully, it won’t be too complex or too boring. I’ll try to keep it as simple as possible.

    So, if you are interested in learning iPhone programming along with me, check back again soon! Or go ahead and subscribe to the RSS feed so you’ll be notified when I make another post.

     
  • Ah! A Blank Page!

    My first post on my new blog.

    Hopefully, the next time you stop by I will have started writing about Logic Design.

    I think it’s important to understand programming from the beginning. I don’t want to get too deep into the electronics and hardware end of things, but I do find the logic interesting and helpful to programming successfully. So, that’s where I want to start.

    Check back again soon!