Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Hourglass Cursor
Thu, Jan 17 2013 1:11 PMPermanent Link

Uli Becker

I use this code to create and show a form. Since that takes some time, I
change the cursor:

      Cursor := crProgress;
      try
        HauptForm := THauptForm.create(Application);
        HauptForm.show;
      finally
        Cursor := crDefault;
      end;

Nothing happens, the cursor doesn't change. What am I doing wrong?

Thanks Uli
Fri, Jan 18 2013 9:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< Nothing happens, the cursor doesn't change. What am I doing wrong? >>

In what context is that code running ?  You will be changing the cursor for
whatever form is running when that code is executed, so the cursor will be
"normal" unless you position the mouse over the calling form.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jan 18 2013 9:50 AMPermanent Link

Uli Becker

Tim,

> In what context is that code running ?  You will be changing the cursor
> for whatever form is running when that code is executed, so the cursor
> will be "normal" unless you position the mouse over the calling form.

The code is executed in the AfterLoad event of a dataset. A new form is
created and an hourglass cursor should be visible.

Whereever I position the cursor, it stays at crDefault.

IOW: what have I to do, just to show an hourglass cursor while another
form is created?

Uli
Fri, Jan 18 2013 11:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< Whereever I position the cursor, it stays at crDefault.

IOW: what have I to do, just to show an hourglass cursor while another form
is created? >>

Please see my response via email.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jan 21 2013 3:32 AMPermanent Link

Mark Brooks

Slikware

Avatar

<<Nothing happens, the cursor doesn't change. What am I doing wrong?>>

Hi Uli,

I have experienced a similar, if not the same, issue. Problems with the cursor not updating are well-document if you Google this topic. My current solution is a tweak to the framework as follows. The extra code that I have added starts with {MCB}:

procedure TDesktop.StartModalForm(Form: TForm; OverlayColor: TColor=clBlack; OverlayOpacity: Double=20);
begin
  if (FModalCount=0) then
     begin
     FModalOverlay:=CreateHTMLElement('div');
     with FModalOverlay.style do
        begin
        position:='absolute';
        display:='none';
        cursor:='wait';
        {MCB}window.scrollby(0,0);
        if IsIE then
           filter:='alpha(opacity='+DoubleToStr(OverlayOpacity)+')'
        else
           opacity:=DoubleToStr(OverlayOpacity/100);
        backgroundColor:=ColorToStr(OverlayColor);
        top:=PixelsToStr(0);
        left:=PixelsToStr(0);
        height:=PixelsToStr(Self.Height);
        width:=PixelsToStr(Self.Width);
        end;
     GetBodyElement.appendChild(FModalOverlay);
     FModalOverlay.style.display:='';
     FModalClickHandler:=SetEventHandler(FModalOverlay,'click',ModalClickHandler);
     end;
  Inc(FModalCount);
end;

procedure TDesktop.EndModalForm;
begin
  if (FModalCount > 0) then
     Dec(FModalCount);
  if (FModalCount=0) then
     begin
     if Assigned(FModalOverlay) then
        begin
          {MCB}FModalOverlay.style.cursor := 'auto';                     
          {MCB}window.scrollby(0,0);
          ClearEventHandler(FModalOverlay,'click',FModalClickHandler);
        end;
     FreeHTMLElement(GetBodyElement,FModalOverlay);
     end;
  UpdateFormZIndexes;
end;

It seems to work fine, but I hope it doesn't break anything elsewhere (Tim?).

Cheers
Mark
Mon, Jan 21 2013 5:38 AMPermanent Link

Uli Becker

Hi Mark,

<<
I have experienced a similar, if not the same, issue. Problems with the
cursor not updating are well-document if you Google this topic. My
current solution is a tweak to the framework as follows. The extra code
that I have added starts with {MCB}
>>

Thanks for this code. But that affects only "ShowModal". I was looking
for a way just to show a wait-cursor while a dataset or form is loaded e.g.

Tim mailed me: he is going to work around this problem in one of the
next builds.

Thanks.

Regards Uli
Mon, Jan 21 2013 10:20 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< I have experienced a similar, if not the same, issue. Problems with the
cursor not updating are well-document if you Google this topic. My current
solution is a tweak to the framework
as follows. The extra code that I have added starts with {MCB}: >>

Hmm, was this done to fix an issue with the modal form display/cursors ?
I'm not aware of any issues with this functionality.

The issue with the cursors was one with how the various control elements are
constructed.  They're now all set up properly to inherit the cursor of their
parent.  So, if you use:

Form1.Cursor:=crWait;

Then as long as all of the child controls have their Cursor properties set
to crAuto, then they'll inherit that of the form (same when setting the
cursor back to crAuto).  This doesn't affect the ability of the user to
interact with the controls, just their cursor.  Also, this doesn't affect
the desktop, but you can also set its cursor by using:

Application.Desktop.Cursor:=crWait;

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Image