Simple RexxDW slider script help

Help
William
2004-06-21
2013-04-11
  • William

    William - 2004-06-21

    I have created a simple Rexx DW script to help me understand
    how to use the package.  Most of the code was extracted from demo/rexxdw.rexx. 

    My problem is that the SliderCallback is never called.

    I tried to put this file on my Yahoo account but their upload
    failed.  Sorry to take up extra space.

    /*              */
    Call RxFuncAdd 'DW_LoadFuncs', 'rexxdw', 'DW_LoadFuncs'
    Call dw_loadfuncs
    Trace "E"

    numeric digits 12

    Call DW_Init

    !global.!screen_width  = dw_screen_width()

    !global.!screen_height = dw_screen_height()

    !global.!style = dw_or( !REXXDW.!DW_FCF_SYSMENU, !REXXDW.!DW_FCF_TITLEBAR,,
                             !REXXDW.!DW_FCF_SHELLPOSITION, !REXXDW.!DW_FCF_TASKLIST,,
                             !REXXDW.!DW_FCF_DLGBORDER )
    /* ----------------------------------------------------------------------- */
    /* Create our Main Window and add Delete CallBack                          */
    /* ----------------------------------------------------------------------- */

    !global.!mainwindow =   dw_window_new( !REXXDW.!DW_DESKTOP, 'Rexx/DW Slider Test',,
                             dw_or( !global.!style, !REXXDW.!DW_FCF_SIZEBORDER,,
                             !REXXDW.!DW_FCF_MINMAX ) )

    Call dw_signal_connect  !global.!mainwindow, !REXXDW.!DW_DELETE_EVENT, 'QuitCallback',,
                             !global.!mainwindow

    Call DW_window_set_size !global.!mainwindow, 800, 400

    Call dw_window_show !global.!mainwindow

    /* ------------------------------------------------------------------------ */
    /* Slider Box                                                               */
    /* ------------------------------------------------------------------------ */

    sliderbox = dw_groupbox_new( !REXXDW.!DW_VERT, 'Slider Test Box' )
    Call dw_box_pack_start !global.!mainwindow, sliderbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ,,
        !REXXDW.!DW_EXPAND_VERT, 2

    /* slider */
    tmpbox = dw_box_new( !REXXDW.!DW_HORZ )

    Call dw_box_pack_start sliderbox, tmpbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ,,
          !REXXDW.!DW_EXPAND_VERT, 0

    tmp = dw_text_new( 'Slider:', 0 )

    Call dw_box_pack_start tmpbox, tmp, 100, 20, !REXXDW.!DW_DONT_EXPAND_HORZ,,
          !REXXDW.!DW_DONT_EXPAND_VERT, 0

    slider = dw_slider_new( !REXXDW.!DW_HORZ, 100, 0 )

    Call dw_box_pack_start tmpbox, slider, 0, 20, !REXXDW.!DW_EXPAND_HORZ,,
          !REXXDW.!DW_DONT_EXPAND_VERT, 0

    /* slider percent */

    tmpbox = dw_box_new( !REXXDW.!DW_HORZ )

    Call dw_box_pack_start sliderbox, tmpbox, 0, 0, !REXXDW.!DW_EXPAND_HORZ,,
          !REXXDW.!DW_EXPAND_VERT, 0

    slider_percent = dw_percent_new( 0 )

    Call dw_box_pack_start tmpbox, slider_percent, 0, 20, !REXXDW.!DW_EXPAND_HORZ,,
          !REXXDW.!DW_DONT_EXPAND_VERT, 0

    Call dw_percent_set_pos slider_percent, 0

    Call dw_signal_connect slider, !REXXDW.!DW_VALUE_CHANGED_EVENT, 'SliderCallback',
       slider_percent

    Call dw_box_pack_start sliderbox, 0, 200, 5, !REXXDW.!DW_DONT_EXPAND_HORZ,,
       !REXXDW.!DW_DONT_EXPAND_VERT, 0

    /* ----------------------------------------------------------------------- */
    /* Main Loop                                                               */
    /* ----------------------------------------------------------------------- */

    Call DW_window_set_size !global.!mainwindow, 800, 400

    Call dw_window_show !global.!mainwindow

    trace "R"
    If !REXXDW.!HAVE_REXXCALLBACK Then
       Do
          Call dw_main
       End
    Else
       Do Forever
          cmd = dw_main_iteration()
       If cmd \= '' Then say cmd
          If cmd \= '' Then Interpret 'Call' cmd
       End

    /* Exit routine ---------------------------------------------------------------- */

    QuitCallback:

    Trace "O"
    Parse Arg win, mainwin
    Call dw_window_destroy mainwin
    Exit 0

    /* ----------------------------------------------------------------------------- */

    SliderCallback: Procedure Expose !REXXDW. !global.

    Say Win Value Percent
    Parse Arg win, value, percent
    Call dw_percent_set_pos percent, value
    Return 0

     
    • emazurek

      emazurek - 2005-06-08

      Hi,

      You need an extra comma at the end of your  dw_signal_connect slider line. Without that extra comma
      'SliderCallback' and slider_percent are being concatenated.

      Ed

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks