ClarionX Updates

    follow me on Twitter

    Subscribe

    Enter your email address:

    Delivered by FeedBurner

    Blog powered by TypePad
    Member since 08/2006

    July 11, 2007

    Twitterfying ClarionX

    Twitter All this week, we have been playing around with Twitter. Twitter has brought internet communication to another level. Some see it as the next irc, some see it as a tumblelog, and others see it as one huge chat room. I think it's a bit more than all of these things, and it's really taking a step forward. Its a way to connect with your community without a lot of effort and in realtime.

    Our experiences with twitter has encouraged us to revamp our blog. Now you can see what we are doing while we are not posting on our blog.

    ClarionX Twitter Updates can be found in the right hand menu.

    Enjoy.

    March 27, 2007

    Global Extension Template - ClarionX.tpl

    How do you write an Global Extension Template?

    You can download the full template here.

    Here is a template I started writing along time ago when I was learning about temples and how they could help me be a more efficient developer....

    Open a text editor and create a new file called for example clarionx.tpl (template)

    1. Define the template Chain

    #TEMPLATE(ClarionXTemplates,'ClarionX Dev Tools 1.0')

    2.  Define the Global Extension Template

    #EXTENSION(ClarionXGlobal,'ClarionX Dev Tools 1.0 Global'),APPLICATION

    ,APPLICATION means that it should only be available as a Global Extension and not at the procedure level.

    3. Give the User/developer  some options to play around with in the IDE...

    To generate an include file, txa or txd and/or perform  backups of application txa after each compile...feel free to take this code and improve it....

    #DISPLAY('ClarionX Dev Tools are Enabled'),AT(10,,,)
    #PROMPT('Generate Include File ' & %Application & '.inc',CHECK),%GenerateAppIncludeFile,DEFAULT(1),AT(10,20,,)
    #PROMPT('Generate TXA File ' & %Application & '.txa',CHECK),%GenerateTxaFile,DEFAULT(0),AT(10,30,,)
    #PROMPT('Generate TXD File ' & %Application & '.txd',CHECK),%GenerateTxdFile,DEFAULT(0),AT(10,40,,)
    #PROMPT('Auto Backup eg. TXA ' & %Application & '_yyyymmdd_hhmmss.txa',CHECK),%AutoBackups,DEFAULT(1),AT(10,50,,)

    These are all pretty self  explanatory steps.

    4. Lets get to the guts....

    To get this template to work we need to make sure this template code is only executed when the template is initialised...

    #ATSTART

    #ENDAT

    Generate INC File .... Pretty Simple

    #IF (%GenerateAppIncludeFile = 1)
    #DECLARE(%AppIncludeFile)
    #SET(%AppIncludeFile,%Application & '.inc')
    #CREATE(%AppIncludeFile)
    #FOR(%Procedure),WHERE(%ProcedureExported = 1)
      %(%Procedure & %Prototype)
    #ENDFOR
    #CLOSE(%AppIncludeFile)
    #ENDIF

    Generate TXA File .... Pretty Simple

    #IF (%GenerateTxaFile = 1)
    #DECLARE(%TxaFile)
    #SET(%TxaFile,%Application & '.txa')
    #CREATE(%TxaFile)
    #EXPORT
    #CLOSE(%TxaFile)
    #ENDIF

    Generate TXD File .... Pretty Simple

    #IF (%GenerateTxdFile = 1)
    #DECLARE(%TxdFile)
    #SET(%TxdFile,%Application & '.txd')
    #CREATE(%TxdFile)
    #MESSAGE('Exporting Dictionary...',2)
    #EXPORT(%DictionaryFile)
    #CLOSE(%TxdFile)
    #ENDIF
    #ENDAT
    #ATEND

    Auto Backup .... Pretty Simple...just a datetime stamped TXA

    #IF (%AutoBackups = 1)
    #DECLARE(%BackupFile)
    #SET(%BackupFile,%Application & '_' & CLIP(FORMAT(%ProgramDateChanged,@d12)) & '_' & CLIP(FORMAT(%ProgramTimeChanged,@t5))&'.txa')
    #CREATE(%BackupFile)
    #MESSAGE('Backing Up Program Settings...',2)
    #EXPORT
    #CLOSE(%BackupFile)
    #ENDIF
    #ENDAT

    You can download the full template here. Simply register it in the template registry and thats it....

    This is a good example of the usefulness of templates. With clarionx.tpl dev tools template you can tick a checkbox and  generate a txa or txd, generate an inc file for your dlls and without knowing it checkpoint your code with autobackups ..... pretty handy.

    More templates coming soon....

    December 04, 2006

    CALL and UNLOAD...The Never Ending Story...

    Thought Clarion App Extensions...

    Wouldn't it be great if we had and architecture which allowed us or 3rd party clarion developers to extend our applications without modifying the base code ... creative use of CALL, UPLOAD and passing an interface class can achieve this...

    More to follow over the next few weeks....

    How to :: Subclass Windows and do Icons in the System Tray!

    Its simple to add code to your Clarion Application and you too can have icons in the System Tray. The concept is sound and simple to do in windows yourself! Microsoft has all the tools you need in their Windows API to help you extend your clarion apps by yourself...
    Here is a starting point...

    To place icons in the system tray Win API Shell Notify Icon Function does all the work for you - providing an interface to add, change and remove icons from the system tray. (See example code below for implementation)

    If you want animated icons in the System Tray you will need to setup a timer event and change the icons to create the effect of animated gif.

    If you want to capture mouse events on the icon you will need to subclass the windows event handlers of the parent clarion window. (See example code below for implementation)

    Once subclassed you can intercept messages to the window and handle them appropriately....like left mouse clicks on the icon in the system tray. You can also handle windows shutdown grace fully! When windows shuts down it sends a system exit message to all applications running...You can then shutdown your application properly and avoid those Application is still active messages....(See example code below for implementation)

    In further articles I will explain Balloon tips and other issues surrounding icons and windows services.

    Learning through doing is an excellent way to become a better programmer but not necessarily a better developer. Having said that a good mix of both skill sets is essential. I believe that any experience a good or painful one helps us grow.

    Here are some example pieces of code that I use in some of my personal applications at home.

    Example Code: (Subclassing Windows Event handlers)

    After opening window do the following....

    SubClassWindows ROUTINE
    SavedProc1 = Window{PROP:WndProc}
    Window{PROP:WndProc} = ADDRESS(SubFunc1)
    SavedProc2 = Window{PROP:ClientWndProc}
    Window{PROP:ClientWndProc} = ADDRESS(SubFunc2)
    DO SetupNID

    Once subclassed you can intercept messages to the window and handle them appropriately....like left mouse clicks on the icon in the system tray. You can also handle windows shutdown grace fully!

    Example Code: (Subclass WndProc)

    Some code adapted from a clarionmag article some years ago.

    SubFunc1 FUNCTION (hWnd,wMsg,wP,lP) ! Declare Procedure
    WM_QUERYENDSESSION Equate(00011H)
    WM_ENDSESSION Equate(00016H)
    CODE ! Begin processed code
    CASE wMsg
    IF WM_QUERYENDSESSION
         RETURN(TRUE)
    OF WM_ENDSESSION
         POST(EVENT:CloseWindow,,MainThread)
         RETURN(TRUE)
    OF EVENT:NIM
    CASE BAND(lP, 0FFFFh)
    OF LOC:WM_LBUTTONUP ! Left mouse click
       POST(Event:NIM:MouseLeft,,MainThread)
    OF LOC:WM_LBUTTONDBLCLK ! Left mouse double click
       POST(Event:NIM:MouseLeft2,,MainThread)
    OF LOC:WM_RBUTTONDOWN ! Right mouse click - pressed
    OF LOC:WM_RBUTTONUP ! Right mouse click - released
       POST(Event:NIM:MouseRight,,MainThread)
    OF LOC:WM_RBUTTONDBLCLK ! Right mouse double click
       POST(Event:NIM:MouseRight2,,MainThread)
    END
    RETURN(0)
    ELSE
    ! Pass the unhandled event and it's params on to the previous window procedure  in the chain
              RETURN(CallWindowProc(SavedProc1,hWnd,wMsg,wP,lP))
          END
    Example Code:(Icons in the Tray)

    Shell Notify Icon does all the work for you here!!!!

    SetupNID ROUTINE
    TrayCString = 'generic_ico'
    NID:cbSize = SIZE(NotifyIconData)
    NID:hWnd = Window{Prop:Handle}
    NID:uID = 100
    NID:uFlags = NIF_ICON + NIF_MESSAGE + NIF_TIP
    NID:uCBmessage = Event:NIM
    !your defined message to capture in the parent clarion window
    NID:hIcon = LoadIcon(SYSTEM{PROP:APPINSTANCE},ADDRESS(TrayCString))
    NID:ToolTip = CLIP(SVC:ToolTip) & CHR(0)
    DO AddIconToTray
    AddIconToTray ROUTINE
    IF Shell_NotifyIcon(NIM_ADD, ADDRESS(NotifyIconData)) THEN
    Icon change success fult
    END
    ChangeIconInTray ROUTINE
    IF Shell_NotifyIcon(NIM_MODIFY, ADDRESS(NotifyIconData)) THEN
    !Suceeded
    ELSE
    !Failed
    END
    RemoveIconFromTray ROUTINE
    IF Shell_NotifyIcon(NIM_DELETE, ADDRESS(NotifyIconData)) THEN

    Removed

    END

    A lot of this code would be easily adaptable to your own reusable class...enjoy learning...

    November 30, 2006

    Paris Hilton is still in Top 10 Google Search Terms...

    Just checked the a couple of sources on the net and the current top 10 search terms on google are:

    1. google
    2. girls
    3. youtube
    4. games cheat
    5. paris hilton
    6. games
    7. myspace
    8. bigfoot sightings
    9. meaning of names
    10. cindy margolis

     

    Closely followed by terms like dogs, fergie, smack that, white and nerdy, jenna jameson and anime....

    Where is the worlds head at ... the terms should be development, ajax, clarion and software....

    How would you write and article about Clarion that involved Paris Hilton, more girls, youtube, game cheats....sightings of bigfoot and a sighting of celebs Cindy Margolis and Jenna Jameson.....it would be easy to include white and nerdy tho....

    HANG ON just did write a post that included those.... :-)

    Go figure...

    Last update: Sun, 05 Nov 2006 08:37:16 GMT

    November 29, 2006

    Clarion 7....When?

    Does anyone know when?

    I am keen to get started on C7 but still no word of an Alpha...

    Wasn't it supposed to be alpha this year??

    Please anyone with any useful info about time lines please post a comment...

    I have several large projects on the go and am trying to make some strategic decisions...

    November 11, 2006

    Gone in less than a Second....

    How to strip HTML Tags from a String Buffer in Clarion is easy as pi....

    Ever needed to extract data from html or clean up you email reader....

    Move a sliding window over the string data; determining when we have found the start and end of a html tag and then cut...its really that easy...

    Example Stripping Code:

    stag# = False
    j# = 1
    LOOP i# = 1 TO LEN(CLIP(pMessage))
    IF pMessage[i#] = CHR(62) AND stag# = True THEN
    stag# = False
    ELSIF pMessage[i#] = CHR(60) AND stag# = False THEN
    stag# = True
    ELSE
    IF NOT stag# THEN OutMessage[j#] = pMessage[i#];j# += 1.
    END
    END

    CHR(62) is '<' tag and CHR(60) is '>' tag....everything inclusive and in between is html formating....there are a few exceptions like converting <br> to carriage return line feeds and &nbsp; and other encoded chars like &#13; etc.....

    But this is perfect for extracting data from http streams...Clarion is a very powerful tool when doing parsing work...

    Cheers...

    September 22, 2006

    Trackbacks Explained...

    TrackBacks are designed to provide a means of notification between websites.

    For example it is a method of person A saying to person B, “This is something you may be interested in.” To do that, person A sends a TrackBack ping to person B. TrackBacks are typically sent from one weblog to another when one publishes a post that includes a link to the other weblog.

    The idea of a TrackBack is based on the priciple of push, rather than pull--if you want to share information with another website, you initiate the connection, rather than waiting for the other website to discover you (and your information).

    Sending a TrackBack is often called a TrackBack ping. A ping in this context means a small message sent from one webserver to another....

    Hopefully this has cleared up what a trackback is...

    September 20, 2006

    Mac OSX Viruses....

    After numerous discussions with my colleagues about the validity of Apple's claim or at least users claim, that they were virus free and safe....I scanned the net and found and interesting article....demonstrating the detection of the first ever virus for Mac OSX....16/02/2006...by Sophos Engineers.

    Feeling vindicated...I believe the proliferation of viruses on an operating system is a function of its popularity and share of the market place...In other words in the majority of cases not including script kiddies virus writers are skillful enough to tackle any OS platform...its just that more people use windows...

    Sophos Article:

    16 February 2006

    First ever virus for Mac OS X discovered

    OSX/Leap-A worm spreads via iChat instant messaging software

    OSX/Leap-A uses an image of a JPEG icon to try and fool users.

    OSX/Leap-A uses an image of a JPEG icon to try and fool users.

    Experts at SophosLabs™, Sophos's global network of virus, spyware and spam analysis centers, have announced the discovery of the first virus for the Apple Mac OS X platform. The virus, named OSX/Leap-A (also known as OSX/Oompa-A) spreads via instant messaging systems....[more]

    John

    September 19, 2006

    Get the Shirt!!!

    You can now get the ClarionX.com Developer T-Shirt....can choose what style and how many you want from our friends at zazzle.com.....You can find the link in the sidebar...just below the new Email Subscribe feature...

    Just subscribe to receive daily email with our newest Clarion and Geek content.....it's that easy...