Problem with partial upd .. function, please help.

Hello.

I'm sorry to start another thread for OnPartialUpdate.

I know there is a lot on the forum, but I have not found a solution and an example that would solve my problem.

I will try to describe here what I need to call regularly via this function.

I have five slashes that I created in the font maker.

These slashes appear to me instead of seconds, ie 1 slash = first second.

It is like
"Knight Rider Car" reads slashes from left to right in seconds. Wink

The problem is that when I do dc.setClip at the bottom of the screen for slash size, width, height, I get to total time fast.


I would ask someone who could help me with this feature.

The best example of how to proceed.


Here's what I'm trying to do in OnPartialUpdate.

I do dcClearClip in OnUpdate...

Thank you

function onPartialUpdate(dc){
		sleepMode = true;

		
		
		dc.setClip(20, 175, 25, 20);
        dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT);
        dc.drawText(20, 175, $.fontIcon_seconds, $.ICON_SECONDS, Gfx.TEXT_JUSTIFY_CENTER);
    	 
 
    	
        }
         }

  • yes, but set up profiler first to run e.g. 10s (maybe it's default) to have significant average value

  • Okay, thank you very much for your help and helpful advice.

    when I change dc.drawText to dc.SetClip, it still reports an error, but I will try to figure it out myself.

  • you have to add clip not replace drawText and of course before drawText and with proper arguments

  • is that right?

         function onPartialUpdate(dc)
      {
    
      	var
    				sec  = Sys.getClockTime().sec,
        			pos = (sec  % 12)  - 1,
        			
        			mColors = [	
    					Gfx.COLOR_BLUE,	
    					Gfx.COLOR_RED, 
    					Gfx.COLOR_BLUE,	
    					Gfx.COLOR_RED,
    					Gfx.COLOR_BLUE,	
    					Gfx.COLOR_RED,
    				],
    				
    				
    				
    				 mPositionTextX_ClipX = [	
    					10,
    					40,
    					70,
    					100,
    					130,
    					null,
    					130,
    					100,
    					70,
    					40,
    					10
    				],
    				
    				
    			
    				
    				
    				mDrawX = 
    				[
    					10,
    					40,
    					70,
    					100,
    					130,
    					null,
    					130,
    					100,
    					70,
    					40,
    					10
    				];
    
    				
    				
    				
    				
    				
    				
    				dc.setColor(
            				mColors[(sec / 6) % 2],
            				0);
     				if(sec % 6)    
     				{ 
     					dc.setClip(mPositionTextX_ClipX[0], 130, mPositionTextX_ClipX[1], 12);
            			dc.drawText(mDrawX[pos], 130, 12, "/",6);
            			
     				}
            		dc.drawText(130, 30, 12, sec.format("%02d"),5);
                    
       }
        }

  • no, you have to adopt this code to your WF. This is the demonstration how to draw from left and righ and if you put it in onUpdate you will see how it run - have you already done it?

    Of course the best is using the same code for update and partial but on the beginning slashes are empty so you have to call drawing several time emulating seconds in the past. But you can have also two "the same" code then:

    - move members arrays to view member and fill them in view.initialise

    - replace drawing text with proper coordinates, fonts etc and the same with clip

  • I understand it's just an example. I asked if I put dc.setCip correctly in the code, you wrote that I should put it above dc.draw.

    look at it and please and if possible, adjust for the OnPartialUpdate function, that's what I need. Thank you

  • it is enough tu run code and you will see if it's ok!!!

    - probably it isn't because you use bad argument

        dc.setClip(mDrawX[pos] -10, 120, 20, 20);

  • it's a little confusing and I won't bother you anymore.

    originally I wanted to know how to use your last code (sample) in the OnPartialUpdate function.

    Well, now I know it's important to use a constant for multiple clips.

    It doesn't solve my problem yet, but maybe he'll figure it out on his own.

  • I'm sorry, but you have shown me almost ready running app with problem with partial draw so I thought you would be able to adopt running example I sent you.

    I don't understand your situation there is a difference between help and  writing app.

    Some people helped me when I started that's why I think I should help others. But always I wrote entire app myself.

  • I wrote the whole application myself, but I just wanted to and I also asked this forum for help with the OnPartialUpdate function for multiple clip (slash) clips that draw seconds.

    You gave me a few examples of how to do this, but we already deviated a bit from the assignment and the place of my font in dc.drawText was this "\".


    I really needed the OPU function with what I do for my WatchFace.

    This way it will be more difficult for me ...

    Of course thank you for your help.

    They will continue to work on it and try it out.