Graphics

 View Only
  • 1.  Circling a date on a calendar

    Posted 05-04-2017 01:00

    I've built a calendar from Excel calendar data saved to a comma delimited text file. The database includes month/year, first day of month, number of days in month and x & y coordinates for all possible positions for 31 dates on a 7x6 grid. Between assigning columns through user input controls and visual logic, everything works---but now, I want to circle a date on the calendar. I had no luck trying visual logic, so I started working on scripting the position of the circle. I found what seemed related on the forum and then wrote the following:



    dim CircledDate as xpBaseObject
    dim DateCircled as xpTextObject
    dim x1 as xpTextObject
    dim y1 as xpTextObject
    dim x2 as xpTextObject
    dim y2 as xpTextObject
    dim x3 as xpTextObject
    dim y3 as xpTextObject

    if Self.GetObjectByName("DateCircled", DateCircled.text) = 1 then
    CircledDate.PosX = x1.text
    CircledDate.PosY = y1.text
    if Self.GetObjectByName("DateCircled", DateCircled.text) = 2 then
    CircledDate.PosX = x2.text
    CircledDate.PosY = y2.text
    if Self.GetObjectByName("DateCircled", DateCircled.text) = 3 then
    CircledDate.PosX = x3.text
    CircledDate.PosY = y3.text
    end if
    end if
    end if


    ...but it doesn't work...and I don't understand how to loop through all possible dates.

    Am I close to the solution? Is it even possible?

    Thanks,
    James.



  • 2.  RE: Circling a date on a calendar

    Posted 05-04-2017 16:23

    Hi there,

    I think a more efficient way to do this might be this way. I assume all of your possible X and Y coordinates are in hidden text values. As long as they have a consistent name scheme, like each day X value is XCoord1, XCoord2, XCoord3, etc.
    When assigning PosX and Y values from a string, you have to convert to a double, Cdbl(). This should get you pretty close.

    dim CircledDate as xpBaseObject
    dim DateCircled as xpTextObject
    dim XCoord, YCoord as xpTextObject

    Self.GetObjectByName("DateCircled", DateCircled)
    Self.GetObjectByName("CircledDate", CircledDate)

    Self.GetObjectByName("XCoord" + DateCircled.text, XCoord)
    Self.GetObjectByName("YCoord" + DateCircled.text, YCoord)


    CircledDate.PosX = Cdbl(XCoord.text)
    CircledDate.PosY = Cdbl(YCoord.text)





    Does this make some sense? It works in my head, just need to translate this to the keyboard.
    Hope this helps!
    Mike


    #XPression


  • 3.  RE: Circling a date on a calendar

    Posted 05-05-2017 16:03
    Mike!

    Thank you, it worked beautifully! I've added a live input layer and bulleted text fields to timeline stories. Next, I'll be working on transition logic for a sequence of dates.

    Thanks,
    James.
    #XPression