Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
1 View

Spin Control Not Working Properly


My RC has:

    EDITTEXT        IDC_PCTYPE,38,48,11,12,ES_CENTER | ES_AUTOHSCROLL | ES_NOHIDESEL | ES_WANTRETURN
    CONTROL         "",IDC_MYSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | UDS_HOTTRACK,48,48,9,12

My Setup has:

     bret = DLGSET (gDlg, IDC_PCTYPE, .TRUE., DLG_ENABLE)
     bret = DLGSET (gDlg, IDC_MYSPIN, .TRUE., DLG_ENABLE)
     bret = DlgSet(gDlg, IDC_MYSPIN, 0, DLG_RANGEMIN)
     bret = DlgSet(gDlg, IDC_MYSPIN, 8, DLG_RANGEMAX)
     bret = DlgSet(gDlg, IDC_MYSPIN, 0, DLG_POSITION)
     mType = 0
     bret = DlgSet(gdlg, IDC_PCTYPE, mType)

My OnSpinEdit ala         

bret = DlgSetSub (gDlg, IDC_PCTYPE, OnSpinEdit)

Is:

   bret = AllocConsole()
   i = DlgGet(gdlg, control_name, myBuffer, DLG_STATE)
   read(myBuffer,*,iostat=iostatus) num
   type *, 'OnSpinEdit num,i = ', num, i
   if (iostatus /= 0) Then
      i = DlgSet(gDlg, control_name, 0)
      mType = 0
   else
      num = max(0, num)
      num = min (num, 8)
      myBuffer = '  '
      write(myBuffer,'(i1)') num
      mType = num
      i = DlgSet(gDlg, IDC_PCTYPE, trim(adjustl(myBuffer)))
      bret = DlgSetInt(gDlg, IDC_MYSPIN,num,DLG_POSITION)
      type *, 'OnSpinEdit myBuffer,i = ', myBuffer, i
   end if
   return

Upon execution I get a dialog with the spin control but no buddy. If I switch
sides with the spin control I get the spin control creating its own buddy and
not using mine. Any suggestions?

Thanks, Brooks V

 

0 Kudos
1 Reply
Highlighted
New Contributor I
1 View

I found my own solution. The

I found my own solution. The RC file should have been:

 

    EDITTEXT        IDC_PCTYPE,35,47,18,14,ES_CENTER | ES_NOHIDESEL | ES_WANTRETURN | WS_GROUP,WS_EX_DLGMODALFRAME
    CONTROL         "",IDC_MYSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNLEFT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_GROUP | WS_TABSTOP,54,47,10,14

 

0 Kudos