Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28487 Discussions

[Solved] Help to set Buddy window for a Spin Control

cean
New Contributor II
772 Views

Hi,

 

I am trying to use the Spin control. How to set the Buddy window?

If I set the 'Auto Buddy' to True, It changes the text on Cancel button, not the Edit or Static control. Do I have to create Spin control after the one I want to use as a Buddy window?

Here is my code. Thanks for help.

 

Cheers,

 

Cean

 

 

    SUBROUTINE UpdateEdit( dlg, control_name, callbacktype )
      !DEC$ ATTRIBUTES  DEFAULT:UpdateEdit
      
      USE IFLOGM
      IMPLICIT NONE
      TYPE (dialog) dlg
      INTEGER control_name
      INTEGER callbacktype
      INCLUDE 'resource.fd'
      CHARACTER(256) text
      INTEGER cel
      LOGICAL retlog
      
      if (callbacktype == dlg_change) then
          retlog = DlgGet( dlg, control_name, cel, DLG_POSITION )
          WRITE (text,*) cel
          retlog = DlgSet( dlg, IDC_EDIT1, TRIM(ADJUSTL(text)) )
      endif
      
    END SUBROUTINE UpdateEdit

    subroutine bjCard(hDC)
        USE IFLOGM
        use ifwinty, only: HANDLE

        implicit none

        INCLUDE 'resource.fd'
        TYPE (dialog) dlg
        integer(HANDLE) hDC
        logical retlog
        integer ai
    
        retlog = DlgInit( IDD_DIALOG1, dlg )
        !retlog = DlgSet( dlg, IDC_STATIC, 1)
        retlog = DlgSet( dlg, IDC_EDIT1, 0)
        retlog = DlgSet( dlg, IDC_SPIN1, 0, DLG_RANGEMIN)
        retlog = DlgSet( dlg, IDC_SPIN1, 8, DLG_RANGEMAX)
        retlog = DlgSet( dlg, IDC_SPIN1, 4, DLG_POSITION)
        !CALL UpdateStatic( dlg, IDC_SPIN1, DLG_CHANGE)
        CALL UpdateEdit( dlg, IDC_SPIN1, DLG_CHANGE)
        retlog = DlgModal(dlg)  
    end
    

 

  

0 Kudos
1 Solution
andrew_4619
Honored Contributor II
765 Views

I do not have experience with 'Auto Buddy' but readying the documentation I suspect the buddy window is the next control in the tab order so you need to adjust the tab order of the controls.

View solution in original post

0 Kudos
2 Replies
andrew_4619
Honored Contributor II
766 Views

I do not have experience with 'Auto Buddy' but readying the documentation I suspect the buddy window is the next control in the tab order so you need to adjust the tab order of the controls.

0 Kudos
cean
New Contributor II
743 Views

After changing the tab order, when I click a spin arrow, it changes the value of the EDIT control.

tab order good.jpg

 

0 Kudos
Reply