WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: pguild on May 04, 2019, 01:39:17 AM

Title: How allow user to double click item in Dialog Box.
Post by: pguild on May 04, 2019, 01:39:17 AM
I would like the user to be able to double click an item in a listbox within a dialog
instead of having to press OK.  Is there any way to enable that?
Title: Re: How allow user to double click item in Dialog Box.
Post by: JTaylor on May 04, 2019, 06:59:08 PM
If you go to the WIL Help file and under the Search Tab enter "dialog itembox double click" and then select ItemBox Control from the results it will provide the needed information.   

Jim
Title: Re: How allow user to double click item in Dialog Box.
Post by: pguild on May 06, 2019, 01:38:31 PM
Thanks, Jim,  :)
Users don't want to have to click a selection and then press enter. They just want to double click an item and continue.
To make the dialog close, I need to set a return to some positive number in the @deIbDblclick case.  That was not easy to discover. :)


#DefineFunction TimerProc(MyDialogHandle,MyDialogMessage,MyDialogControlID,MyDialogEventInfo,MyDialogChangeInfo)
Switch MyDialogMessage
   Case @deInit
      ; enable 1 second timer events
      DialogProcOptions(MyDialogHandle, @deTimer, 1000)
      DialogProcOptions(MyDialogHandle, @deIbDblclick,1)

      Return (@retdefault)
   Case @detimer
      Clock=DialogControlGet(MyDialogHandle, "VaryText_1", @dcTitle)
      Clock=Clock-1
      If Clock==0 Then Return(2) ; exit, buttonpushed==2
      DialogControlSet(MyDialogHandle, "VaryText_1", @dcTitle, Clock)
      Return(@retDefault)
   Case @deIbDblclick
      pause("Yes","You double clicked!")
          ;RETURN(@retDefault) ;?????????????????????  WRONG
          RETURN(1)

EndSwitch ; MyDialogMessage
Return(@retDefault) ; Do default processing
#EndFunction

;main;
dlg_itembox = strcat("Never talk about mistakes",@TAB,"Seek Clarity",@TAB,"Define Targets for Improvement")
TimerFormat=`WWWDLGED,6.2`

TimerCaption=`Timer Example`
TimerX=078
TimerY=129
TimerWidth=382
TimerHeight=198
TimerNumControls=004
TimerProcedure=`TimerProc`
TimerFont=`DEFAULT`
TimerTextColor=`DEFAULT`
TimerBackground=`DEFAULT,DEFAULT`
TimerConfig=0

Timer001=`013,083,034,014,PUSHBUTTON,"PushButton_1",DEFAULT,"OK",1,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer002=`067,083,034,014,PUSHBUTTON,"PushButton_2",DEFAULT,"Cancel",0,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer003=`023,015,070,052,VARYTEXT,"VaryText_1",clock,"100",DEFAULT,DEFAULT,@csCenter,"Tahoma|49152|70|34","128|0|0",DEFAULT`
Timer004=`199,019,102,134,ITEMBOX,"ItemBox_1",dlg_itembox,DEFAULT,DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("Timer")
pause("You Picked",dlg_itembox)

RETURN
Title: Re: How allow user to double click item in Dialog Box.
Post by: JTaylor on May 06, 2019, 02:17:55 PM
Try this. 
Jim


Code (winbatch) Select


#DefineSubRoutine TimerProc(MyDialogHandle,MyDialogMessage,MyDialogControlID,MyDialogEventInfo,MyDialogChangeInfo)
  Switch MyDialogMessage
     Case @deInit
        ; enable 1 second timer events
        DialogProcOptions(MyDialogHandle, @deTimer, 1000)
        DialogProcOptions(MyDialogHandle, @deIbDblclick,1)
        Break
     Case @detimer
        Clock=DialogControlGet(MyDialogHandle, "VaryText_1", @dcTitle)
        Clock=Clock-1
        If Clock==0 Then Return(2) ; exit, buttonpushed==2
        DialogControlSet(MyDialogHandle, "VaryText_1", @dcTitle, Clock)
        Break
     Case @deIbDblclick
        dc_value = DialogControlGet(MyDialogHandle,"ItemBox_1",@dcSelect)
        RETURN 99
        Break
  EndSwitch ; MyDialogMessage
  Return @retNoExit
#EndSubRoutine

;main;
dlg_itembox = strcat("Never talk about mistakes",@TAB,"Seek Clarity",@TAB,"Define Targets for Improvement")
TimerFormat=`WWWDLGED,6.2`

TimerCaption=`Timer Example`
TimerX=078
TimerY=129
TimerWidth=382
TimerHeight=198
TimerNumControls=004
TimerProcedure=`TimerProc`
TimerFont=`DEFAULT`
TimerTextColor=`DEFAULT`
TimerBackground=`DEFAULT,DEFAULT`
TimerConfig=0

Timer001=`013,083,034,014,PUSHBUTTON,"PushButton_1",DEFAULT,"OK",1,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer002=`067,083,034,014,PUSHBUTTON,"PushButton_2",DEFAULT,"Cancel",0,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer003=`023,015,070,052,VARYTEXT,"VaryText_1",clock,"100",DEFAULT,DEFAULT,@csCenter,"Tahoma|49152|70|34","128|0|0",DEFAULT`
Timer004=`199,019,102,134,ITEMBOX,"ItemBox_1",dlg_itembox,DEFAULT,DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("Timer")

pause("You Double-Clicked...",dc_value)

RETURN
Title: Re: How allow user to double click item in Dialog Box.
Post by: pguild on May 07, 2019, 05:59:39 PM
Hi Jim, thanks for your response.

Yes returning 99 will work, but returning any positive number also works as in my example, where I return 1.
Title: Re: How allow user to double click item in Dialog Box.
Post by: JTaylor on May 07, 2019, 08:15:17 PM
Guess I am misunderstanding???   Does it not continue after double-clicking an item and returning its value as requested?

Jim
Title: Re: How allow user to double click item in Dialog Box.
Post by: td on May 08, 2019, 08:06:49 AM
Quote from: pguild on May 06, 2019, 01:38:31 PM
Thanks, Jim,  :)
Users don't want to have to click a selection and then press enter. They just want to double click an item and continue.
To make the dialog close, I need to set a return to some positive number in the @deIbDblclick case.  That was not easy to discover. :)

The effects of a user-defined dialog callback procedure's return values are documented in the Consolidated WIL Help file.  See:

Home > Windows Interface Language Reference > Things to Know > Dialogs > Dynamic Dialogs