Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

supercontrol clock in realtime

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • supercontrol clock in realtime

    How to make the clock running in real time?

    A cal_field with expression of upper(totime(toseconds(time()),11,0)) only show a digital time.
    I added the expression within the supercontrol events, but did not get the clock running either.

    Any help is appreciated.

    I upload my test file.

  • #2
    Re: supercontrol clock in realtime

    Hi Razali,

    Change the Timer intervals to 1 and the expression for the calc clock field to totime(toseconds(time()),12,2).

    There is a moving clock example in Samples/Xbasic folder.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


    • #3
      Re: supercontrol clock in realtime

      Thank you Keith for the information. I saw the sample but could not get the right expression. I hope to make use of the given supercontrol in V9.

      Thanks again.

      Regards,

      Razali

      Comment


      • #4
        Re: supercontrol clock in realtime

        Hello Keith,

        I could not get the calc clock to work. The supercontrol clock seem can not bind any calc field. Where do you place the expression?

        Thanks,

        Razali

        Comment


        • #5
          Re: supercontrol clock in realtime

          Razali,

          Using your sample I placed the following in the OnTimer event and set the timer in the form properties to 60 seconds as the clock only shows in minutes any way.

          Code:
          thistime = now()
          xdialog1.refresh()
          Tim Kiebert
          Eagle Creek Citrus
          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

          Comment


          • #6
            Re: supercontrol clock in realtime

            Dear Kim,

            It is working now. The clock is 'alive'.
            Thanks for the tips.

            This message board is certainly dynamic , active and supported by many knowledgeable and helpful programmers.


            Regards,

            Razali

            Comment


            • #7
              Re: supercontrol clock in realtime

              Dear Tim,

              I apologize and sorry for typing your name incorrectly.

              I think I was too happy with your tips, which save my time in doing my current project.

              Thanks again for your help.

              Regards,

              Razali

              Comment


              • #8
                Re: supercontrol clock in realtime

                Hi Tim,

                Thanks for
                Code:
                thistime = now()
                xdialog1.refresh()
                I found that I had to also put this in the OnInit event as the clock was not visible when the form was opened.

                Although the clock does refresh to the computer time, how do you fix the clock to prevent the user from moving the hands?
                Regards
                Keith Hubert
                Alpha Guild Member
                London.
                KHDB Management Systems
                Skype = keith.hubert


                For your day-to-day Needs, you Need an Alpha Database!

                Comment


                • #9
                  Re: supercontrol clock in realtime

                  Here is a function that produces a clock on a fully dockable panel.

                  Code:
                  'Date Created: 22-Apr-2008 03:31:37 AM
                  'Last Updated: 22-Apr-2008 03:31:37 AM
                  'Created By  : lance
                  'Updated By  : lance
                  function dp_clock as v ()
                  with vars 
                  'Notice that the code in this function is wrapped in a 'with vars...end with' statement.
                  'Local_variables() are passed in when the function is called. 
                  'Because of the 'with vars' statement, this code is executing in the same variable frame as the Xdialog so it can
                  'see all of the variables in the Xdialog.
                  DIM SHARED cl as T
                  DIM cl_Clock as P
                  cl=time("",now())
                  DIM cl_Clock.events as C = <<%str%
                  function onTimeSelect as v (ptr as p)
                      
                      ' Generated code. Do not delete!
                      ' ------------------------------------------------------------------------
                      if eval_valid("ptr.variableName") then
                          dim sv as p
                          sv = session_variables()
                          evaluate_template("sv."+ptr.variableName+" = if(typeof(sv."+ptr.variableName+")=\"T\",ptr.time,ptr.shortTime)")
                      end if
                      ' ------------------------------------------------------------------------
                  end function
                  
                  function onMeridianChange as v (ptr as p)
                      
                  end function
                  %str%
                  
                  if typeof(cl) = "Y" then
                      DIM cl_Clock.shortTime as Y = cl
                  else
                      DIM cl_Clock.time as T = cl
                  end if
                  DIM cl_Clock.variableName as C = "cl"
                  
                  dim dlg_panel_body as c 
                  dlg_panel_body = <<%dlg%
                  {background=Pale Blue}
                  {timer=increment}
                  {interval=1}
                  {stretch=height,width}
                  {TimePicker=40,15cl_Clock}{watch=cl!update_cl_Clock};
                  {stretch=}
                  {stickto=bottom,left}
                  %dlg%
                  dim dlg_panel_event as c 
                  dlg_panel_event = <<%code%
                  if a_dlg_button = "increment" then
                  
                      cl_Clock.shortTime=time("",now())
                  
                  
                      
                  
                  end if
                  
                  
                   
                  %code%
                  'ui_dlg_panel() is like ui_modeless_dlg_box(), except that it is used to launch xdialogs that are hosted in Panels.
                  ui_dlg_panel("panel5",dlg_panel_body,dlg_panel_event)   
                  end with         
                  end function
                  For information on using dockpanels see 'user defined dock panels' in learning xdialog database

                  Comment


                  • #10
                    Re: supercontrol clock in realtime

                    Good morning Lance,

                    How do you use this function?
                    Regards
                    Keith Hubert
                    Alpha Guild Member
                    London.
                    KHDB Management Systems
                    Skype = keith.hubert


                    For your day-to-day Needs, you Need an Alpha Database!

                    Comment


                    • #11
                      Re: supercontrol clock in realtime

                      Good Morning Keith,

                      I use xdialog a lot, find it a lot better than using forms, and with HTML you can make them look very good. One of the main uses in my application is menu screens, I create MDI xdialogs as they can be minimized, maximized etc. The main xdialog has data relevant to that day and various dock panels around that show other information and menu items, one of which is a clock as above. The code to do the dock_panels is:
                      Code:
                      'This XML string defines the Dock Panels that get installed for this MDI window.
                      'In this example we have two user defined Dock Panels, and one of the built in Alpha Five Dock Panels (the Database Explorer).
                      'Each <panel> tag in the XML string defines a panel.
                      'Name - the name that appears in the title bar of the panel
                      'Icon - the icon that is displayed when the panel is minimized
                      'Install - the xbasic code to run to instantiate the panel.
                      '    In this case the functions that instantiate Panel1 and Panel2 are local function defined in this script.
                      '    When Alpha Five insantiates the Dock Panels it cannot see local functions in this script, so it cannot see the dockpanel_1() and
                      '    docpanel_2() functions. Therefore we have to use the ui_dlg_eval() function to call the functions IN THE CONTEXT of the MDI Xdialog.
                      '    ui_dlg_eval() takes two arguments: the dialog title, and the expression to evaluate in the context of the specified dialog.
                      '    Note that we use a placeholder '__dlg_title__' for the dialog title, and then we do a stritran() to replace the 
                      '    placeholder with the actual value of the dialog title.
                      '    Note also that we pass in local_variables() to the two functions that open the Dock Panels so that these functions can operate in the same
                      '    variable namespace as the MDI Xdialog (i.e. the Dock Panels can see and set variables in the MDI Xdialog).
                      
                      
                      
                      dim xml_Panels as c 
                      xml_Panels = <<%xml%
                      <panels>
                              <panel name="Panel2" description="Upcoming tasks" icon="$a5_open" install="dp_todo(local_variables())" />
                          <panel name="Panel3" description="Current Jobs" icon="$$database"  install="dp_jobs(local_variables())" />
                          <panel name="Panel4" description="Calendar" icon="$$control.calendar" install="dp_cal()" />
                          <panel name="Panel5" description="Clock" icon="$$control.clock" install="dp_clock()" />
                          <panel name="Panel6" description="Open Items" icon="$$presentation.form" install="dp_openitems(local_variables())" />
                          <panel name="Panel7" description="Estimates" icon="$$presentation.form" install="dp_estimates(local_variables())" />
                          <panel name="Panel8" description="menu1" icon="$$presentation.form" install="dp_casc_menu(local_variables())" />
                      
                      </panels>
                      
                      
                      %xml%
                      
                      'Replace the placeholder with the actual dialog title.
                      xml_Panels = stritran(xml_Panels,"__dlg_title__",dlg_title)
                      
                      ui_modeless_dlg_box(dlg_title,<<%dlg%
                      {icon=A5_ball_green}
                      {timer=increment}
                      {interval=60}
                      {mdichild=mymdiclass}
                      {startup=init}
                      {on_activate=onactivate}
                      {stretch=width,height}
                      {HTMLForm=1,3htmlform}
                      {stretch=}
                      {lf};
                      
                      
                      %dlg%,<<%code%
                      if a_dlg_button = "increment" then
                      tim=time()
                          select 
                       	case tim<"11:59" 
                          daytime="morning"
                          case tim>"12:00" .and. tim<"18:00"
                          daytime="afternoon"
                          case tim>"18:00"
                          daytime="evening"
                          
                      end select
                      message ="Good "+daytime+" "+w_upper(word( user_name(),1))
                      tables.outstpay=getpayTable()
                      outsttotal=tablesum("invoice header","due_date<date()+10","outstanding")
                      outtotaltxt=transform(outsttotal,"$$,$$$,$$$.99")     
                      end if
                      if a_dlg_button = "init" then 
                              'show the toolbar
                              dim pDummy as p 
                              pDummy.dummy = ""
                              dim contextName as c 
                              contextName = "Mdi_Example" + session_get()
                             topparent.Maximize() 
                             
                              'create a new context for menus and toolbars.
                              'any menus and toolbars that are intialized after the context has been created are 
                              'NOT shown when the code that initializes them is executed.
                              'They are shown however, when the context is set.
                              
                              ui_context_create(contextName,"MDI_TEST")
                              'toolbar_name = a5_system_toolbar_show(pDummy,toolbar_string)
                              
                              'show the menu
                              'the ui_expand_branched() function is used to expand certain menu 'macros' (such as recent file list, or window list)
                              'at runtime.
                              ui_top_menu(ui_expand_branches(menu_string),event_string)
                              
                              
                              
                              'This is the command that actually loads into memory the Dock Panels specified in the XML string 'xml_panels'
                              ui_context_panels_load(contextName,xml_Panels)
                              
                              'This command restores the position of all Dock Panels.
                              'The position is automatically saved when the MDI window is closed.
                              ui_context_panels_restore(contextName,.t.)
                              'Note: The very first time this script is run, no Dock Panels will be shown until the user explicitly launches them
                              'from the 'Task List' menu item. 
                              'If you want to open Dock Panels automatically when the window is launched for the first time, see commented code below
                              'in the 'onActivate' event handler
                              
                              
                      
                              'set the context - this will explicitly display a set of menus and toolbars that have been saved under a 
                              'named context
                              ui_context_set(contextName)
                              
                              'bind the context to the session so that when the session is activated, it automatically does a 
                              'ui_context_set() to show the toolbars and menus that 'belong' to it, and then when the session is 
                              'destroyed, it automatically does a ui_context_destroy() 
                              ui_context_session_bind(contextName)
                              
                      end if 
                      
                      
                      if a_dlg_button = "activate"      
                             a_dlg_button = ""   
                                 
                             'if flagFirstTimeRun then 
                             '	this is the code to programmatically open a Dock Panel.
                      	   '    ui_dock_panel_show("Panel1",.t.)
                             '	ui_dock_panel_show("Panel2",.t.)
                             '	set firstTimeRun to .f. and store value somewhere so that it can be read every time this script is run. 
                             '	(you could store it in the registry)
                             'end if 
                      end if
                      I have not checked if this will run 'out of the box' but doubt it as it will try and load other dock_panels and the MDI class is not defined so - More information can be found in the learning xdialog sample database

                      Comment


                      • #12
                        Re: supercontrol clock in realtime

                        Keith (and others),

                        This produces a standalone dialog box with a clock in it. This could be put into a toolbar if required.

                        Code:
                        DIM SHARED cl as T
                        DIM cl_Clock as P
                        cl=time("",now())
                        DIM cl_Clock.events as C = <<%str%
                        function onTimeSelect as v (ptr as p)
                            
                            ' Generated code. Do not delete!
                            ' ------------------------------------------------------------------------
                            if eval_valid("ptr.variableName") then
                                dim sv as p
                                sv = session_variables()
                                evaluate_template("sv."+ptr.variableName+" = if(typeof(sv."+ptr.variableName+")=\"T\",ptr.time,ptr.shortTime)")
                            end if
                            ' ------------------------------------------------------------------------
                        end function
                        
                        function onMeridianChange as v (ptr as p)
                            
                        end function
                        %str%
                        
                        if typeof(cl) = "Y" then
                            DIM cl_Clock.shortTime as Y = cl
                        else
                            DIM cl_Clock.time as T = cl
                        end if
                        DIM cl_Clock.variableName as C = "cl"
                        
                        dim dlg_panel_body as c 
                        dlg_panel_body = <<%dlg%
                        {can_exit=close}
                        {background=Pale Blue}
                        {timer=increment}
                        {interval=1}
                        {stretch=height,width}
                        {TimePicker=40,15cl_Clock}{watch=cl!update_cl_Clock};
                        {stretch=}
                        {stickto=bottom,left}
                        %dlg%
                        dim dlg_panel_event as c 
                        dlg_panel_event = <<%code%
                        if a_dlg_button = "increment" then
                        
                            cl_Clock.shortTime=time("",now())
                        
                        
                            
                        
                        end if
                        if a_dlg_button = "close" then
                            ui_modeless_dlg_close("clock")
                        end if
                        
                         
                        %code%
                        ui_modeless_dlg_box("clock",dlg_panel_body,dlg_panel_event)

                        Comment


                        • #13
                          Re: supercontrol clock in realtime

                          Hi Lance,

                          the clock looks great and useful.

                          How do we add the numeric input like the supercontrol clock?

                          Thanks

                          Razali

                          Comment


                          • #14
                            Re: supercontrol clock in realtime

                            Hi Razali,

                            As the title of this thread suggests this is a clock in realtime, ie it counts in minutes of the day. You can set the initial time to something different by setting cl in line 3 to any time value

                            Comment


                            • #15
                              Re: supercontrol clock in realtime

                              Hi Lance,

                              That is very cute. Whilst you can move the hands they jump back to the current time.

                              This can be run from an OnActivate event of say, the Main Menu. Once run it will stay active throughout the session or until you close it.
                              Regards
                              Keith Hubert
                              Alpha Guild Member
                              London.
                              KHDB Management Systems
                              Skype = keith.hubert


                              For your day-to-day Needs, you Need an Alpha Database!

                              Comment

                              Working...
                              X