Horizontal Scroll Issue

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Version: 4.0.0258
Platform: .NET 2.0
Environment: Windows Vista (32-bit)
Avatar
Hi,
We found an issue in the horizontal scroll bar where it will flickers on and off. It happens if a syntax editor's ScrollBarType is set to Both and the text in the editor has lines that are wider and narrower than the size of the control. To recreate it, you can the scroll bar type to Both on the "CodeFragmentsForm" of the test application. Launch the app. Paste the code at the bottom of this post into the editor (most any text will do, I just know this one will cause it to happen. Scroll down towards the bottom by mouse dragging on the vertical scroll. Keep the mouse held down and near the bottom you should be able to find an area where the flicker will occur. I think one easy fix would change the horizontal scroll so it treats the text in the control as rectangular instead of jagged as it is right now. That way the scroll bar wouldn't change during a vertical scroll.

thanks,
Jake
// initialize counters
wcRestart = 0;

ArrayList OperatorList = new ArrayList(); for (int y = 0; y < NumOps; y++) {
    ArrayList OperatorSuspendedTaskList = new ArrayList();
    for (int z = 0; z < SuspTskOpList[y].Count; z++)
    {
        int task = (int)SuspTskOpList[y][z];
        OperatorSuspendedTaskList.Add(task);
        //Model.Message("running task = " +TaskMSStringIDLookup(task));
    }
    OperatorList.Add(OperatorSuspendedTaskList);
}

ArrayList TaskList = (ArrayList)OperatorList[optr];

if ((Clock >= 15) && (optr == 0))
{
    Model.PrintOutput("RESUMEWL  :     " + "list count=" + 
TaskList.Count + "   " + "optr : " + optr + "Clock: " + Clock);
}

for (i = 0; i < TaskList.Count; i++)
{
    wcTaskCnt = (int)TaskList[i];

    if (wcSeqFlag[wcTaskCnt] == false)
    {
        if ((ts[wcTaskCnt, 0] == 2) && (ts[wcTaskCnt, 1] == wcResumeOp) && (curgolstatus[goalparent[wcTaskCnt]] != 2))
        {
            //wcRestart=1; I have commented it out cos this is
            //the only place it is set to 1 and I am not sure what it's purpose is.

            rpttask = wcTaskCnt;
            TaskIDname = TaskMSStringIDLookup(rpttask);
            rptstart = 3;
            rptstrat = 6;
            rptstring = "Resumed";
            wcNumTasks[ts[wcTaskCnt, 1]]++;
            WkTskOpList[ts[wcTaskCnt, 1]].Add(wcTaskCnt);
            tempnumtask = wcNumTasks[wcResumeOp];
            listcount = WkTskOpList[wcResumeOp].Count;


            ts[wcTaskCnt, 0] = 1;
            suspendtask[wcTaskCnt] = 0;
            idcounter[wcTaskCnt] = 0;
            ts[wcTaskCnt, 1] = wcResumeOp;
            rptop = ts[wcTaskCnt, 1];
            optr = rptop;
            CREWWORK();
            rptwkld = wkld[rptop];

            if (Model.RunNumber == 1)
            {
                Model.TriggerSnapshot("RptTask");
            }

            Model.Resume("ID", TaskMSStringIDLookup(wcTaskCnt));

            SuspTskOpList[wcResumeOp].RemoveAt(i);
        }

        // task is marked to be stopped and belongs to this operator, so take a picture
        // of the status for the rpttask snapshot and start it
        if ((ts[wcTaskCnt, 0] == 3) && (ts[wcTaskCnt, 1] == wcResumeOp) && (curgolstatus[goalparent[wcTaskCnt]] != 2))
        {
            wcRestart = 0;
            rpttask = wcTaskCnt;
            TaskIDname = TaskMSStringIDLookup(rpttask);
            rptstart = 4;
            rptstrat = 6;
            rptstring = "Restarted";
            tempnumtask = wcNumTasks[wcResumeOp];
            idcounter[wcTaskCnt] = 0;
            //RptTask snapshot taken for task restarted
            if (Model.RunNumber == 1)
            {
                Model.TriggerSnapshot("RptTask");
            }

            SuspTskOpList[optr].RemoveAt(i);
            Entity tempEnt = new Entity(Entity);
            tempEnt.Opid = ts[wcTaskCnt, 1];
            tempEnt.ID = TaskMSStringIDLookup(wcTaskCnt);
            //Model.PrintOutput("trying to restart:" + tempEnt.ID);
            Model.Start(tempEnt);
            ts[wcTaskCnt, 0] = 1;
        }
    }
    else
    {
        if (curgolstatus[goalparent[wcTaskCnt]] != 2)
        {
            //if(Clock>1.67)
            //Model.Message("removing="+wcTaskCnt);
            wcSeqFlag[wcTaskCnt] = false;
            wcStratCFlag[wcTaskCnt] = false;
            idcounter[wcTaskCnt] = 0;
            SuspTskOpList[optr].RemoveAt(i);
            //I am  commenting out the snapshot. All though I take a snapshot I am not sure why a snapshot is needed here
            //becuase if Strategy C flag is true,then the release condition is evaluated (because a model.start is done) where a snapshot is taken
            //More over none of the rpt variables are assigned here making this snapshot wrong.

            //if(Model.RunNumber==1)
            //Model.TriggerSnapshot("RptTask");
            //Model.Start(TaskMSStringIDLookup(wcTaskCnt),ts[wcTaskCnt,1]);
            //It used to be the above line but that was starting multiple entities
            //so needed to redo it in this way.

            Entity tempEnt = new Entity(Entity);
            tempEnt.Opid = ts[wcTaskCnt, 1];
            tempEnt.ID = TaskMSStringIDLookup(wcTaskCnt);
            Model.Start(tempEnt);
            //Model.Message("i in the if cond="+i);
        }
    }
}

// reset the Task ID variable
//TaskID=wcTempTask;


Comments (6)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for the sample code Jake. I can repro it with this.

The problem is that we treat the text width as jagged for performance reasons. Otherwise you'd have to keep track of thousands of widths in large documents and you'd have to max them all out again any time a change was made. With our code, we only care about what is visible and therefore can do updates fast. I hope that explains the reasoning behind the design.

This does appear to be a bug though. It may be tricky to figure out a solution quickly, but thank you for the sample code since we can work with this to debug with.


Actipro Software Support

Posted 12 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
Sounds good.

thanks,
Jake
Posted 12 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
Hi,
Is there any update on this issue?
thanks,
Jake
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, but it's still not perfect. Here's the problem, the height of the vertical scrollbar is changing. And when it does, the mouse's relative location to the scrollbar's current position is changing. At the point you see, it goes into an endless flicker because the mouse move fires after the arrange that hides the horiz scrollbar. Then the mouse move there kicks in again thinking we moved the mouse (even though we haven't) and restores the horiz scrollbar.

What I've done is not fire the mouse move code if the MouseMove event is raised for the same screen location. This prevents the constant flickering however there is still some jumpiness when you move again due to the scrollbar being a different height when the horiz scollbar is displayed or not, and therefore the location it thinks you are trying to go to in the vertical scrollbar is different. It's hard to explain, but are you with me so far? :)


Actipro Software Support

Posted 12 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
Thanks for the update. I think jumpy sounds like a big improvement over flicker.

[Modified at 01/30/2008 03:25 PM]
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The problem is that this change requires a WinUICore update. So it may be a little while before it gets in.

I also would like to continue to think about it to see if anything else can be done to remove the jump as well.

[Modified at 01/30/2008 03:30 PM]


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 9 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.