Project

General

Profile

Bug #6994

session:set-wait-state("general") must mimic UI responsiveness and UI mouse pointer behavior

Added by Tijs Wickardt over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:

History

#1 Updated by Tijs Wickardt over 1 year ago

See testcase below.

  1. At hBtnWaitstate of the (default-) window , the UI is irresponsive. At the hBtnWaitstate of the invoked dialog, it is responsive.
  2. In an explicit nested wait-for, setting it multiple times doesn't make any difference. There is no queue or stack, AFAICT.
  3. A dialog (including message view-as alert-box) clears the hourglass state, both visually and responsive-wise.

The window (-p procedure):

hourglass_setwaitstate_main.p

define frame f with no-box
  size 80 by 22.

create widget-pool.

if session:window-system begins "MS-WIN" then 
  assign
    default-window:width = 240
    frame f:width        = 240.

&scop btn hBtnHourglassAlertbox
define variable {&btn} as handle no-undo.
create button {&btn} assign 
  frame              = frame f:handle
  width              = 25
  column             = 1
  row                = 1
  label              = "{&btn}" 
  sensitive          = true.
on choose of {&btn} persistent run OnButtonClick in this-procedure ({&btn}).

&scop btn hBtnHourglassDialog
define variable {&btn} as handle no-undo.
create button {&btn} assign 
  frame              = frame f:handle
  width              = 25
  column             = 1
  row                = 2
  label              = "{&btn}" 
  sensitive          = true.
on choose of {&btn} persistent run OnButtonClick in this-procedure ({&btn}).

&scop btn hBtnWaitstate
define variable {&btn} as handle no-undo.
create button {&btn} assign 
  frame              = frame f:handle
  width              = 25
  column             = 1
  row                = 3
  label              = "{&btn}" 
  sensitive          = true.
on choose of {&btn} persistent run OnButtonClick in this-procedure ({&btn}).

// Main block

view frame f.
wait-for escape of frame f.
delete widget-pool.
if valid-handle(default-window) then default-window:hidden = true.

procedure OnButtonClick:
  define input  parameter hWidget as handle no-undo.
  case hWidget:
    when hBtnHourglassAlertbox then 
      do:
        session:set-wait-state("general").
        message "hello world" view-as alert-box.
      end.
    when hBtnHourglassDialog then 
      do:
        session:set-wait-state("general").
        run hourglass_setwaitstate_sub_dialog.p.
      end.
    when hBtnWaitstate then 
      do:
        session:set-wait-state("general").
      end.
  end case.
end procedure.

/* EOF */

The dialog (called by window above):

hourglass_setwaitstate_sub_dialog.p

define variable hBtnOK as handle no-undo.

define frame f with 
  view-as dialog-box keep-tab-order 
  side-labels no-underline three-d scrollable
  default-button hBtnOK 
  title "dialog" 
  size 80 by 22.

&scop btn hBtnOK
create button {&btn} assign 
  frame              = frame f:handle
  width              = 25
  column             = 1
  row                = 1
  label              = "{&btn}" 
  sensitive          = true.
on choose of {&btn} persistent run OnButtonClick in this-procedure ({&btn}).

&scop btn hBtnWaitstate
define variable {&btn} as handle no-undo.
create button {&btn} assign 
  frame              = frame f:handle
  width              = 25
  column             = 1
  row                = 2
  label              = "{&btn}" 
  sensitive          = true.
on choose of {&btn} persistent run OnButtonClick in this-procedure ({&btn}).

create widget-pool.

// Main block
session:set-wait-state("general").
view frame f.
wait-for go of frame f.

procedure OnButtonClick:
  define input  parameter hWidget as handle no-undo.
  case hWidget:
    when hBtnOK then 
      do:
        apply "go" to frame f.
      end.
    when hBtnWaitstate then 
      do:
        session:set-wait-state("general").
      end.
  end case.
end procedure.

/* EOF */

Also available in: Atom PDF