Topic: AppGraphics Drop Down List getdropdownlisttext function not working

I have a problem with getdropdownlisttext function causing program to stop and return to the IDE.
I have a similar problem with MultilineTextBoxes, but I will do a seperate post for that.  All the other Appgraphics controls are working fine for me.

Here is an example

! AppGraphics Drop Down Lists example
program DropDownList

use Appgraphics
implicit none

integer :: winMain
integer :: ddlId, ddlEntries

interface
  subroutine ddlCallBack()
  end subroutine ddlCallBack
end interface

  write(*,*) "Drop Down List Test"

  winMain = initwindow(800, 600, title="App Graphics Drop Down List",  closeflag=.TRUE.)
  call setbkcolor(LIGHTGRAY)
  call clearviewport
 
  !! create a dropdown list
  ddlId = createdropdownlist(50, 50, 300, 300, ddlCallBack)

  ddlEntries = insertdropdownlistentry(ddlId, -1, "1 first item" )
  ddlEntries = insertdropdownlistentry(ddlId, -1, "2 second time" )
  ddlEntries = insertdropdownlistentry(ddlId, -1, "3 try again" )
  ddlEntries = insertdropdownlistentry(ddlId, -1, "4 one more" )
  ddlEntries = insertdropdownlistentry(ddlId, -1, "5 another one to go" )
  ddlEntries = insertdropdownlistentry(ddlId, -1, "6 final entry" )
   
  call loop()
   
  call closewindow(winMain)
end program DropDownList

subroutine ddlCallBack()
  use Appgraphics
  implicit none
 
  character(len=5) :: txt  ! for numeric to integer string conversion
  character(len=50) :: ddlSelText !  to hold the selected line of text
  integer :: ddlSel, TextLen, ListId
 
  ListId = getcallbackcontrolid()

  ! check that we get the correct line number
  ddlSel = getdropdownlistselection(ListId)  !! zero based
 
  write(txt, '(i5)' ) ddlSel
  call dlgmessage(DIALOG_INFO, " got ddl Selection (zero based) " // txt)
 
  ! now get the actual text from that line
  TextLen = getdropdownlisttext(ListId, ddlSel, ddlSelText) !***** this is where it crashes
   
  ! check that the length returned makes sense
  write(txt, '(i15)' ) TextLen
  call dlgmessage(DIALOG_INFO, " got TextLen " // txt )
  ! display the line selected
  call dlgmessage(DIALOG_INFO, " drop down item selected " // ddlSelText)
 
end subroutine ddlCallBack


When the program gets to the TextLen = .... line then is just stops and returns to the IDE.
I cant seem to run debug on Appgraphics, a black window opens and the spinner goes around indicating it is doing something, and nothing happens.  That is why I put in the dialog boxe messages to see what is going on.
If I comment out the TextLen =  .... line   then the program runs, but of course the messages are invalid.

Any ideas ?  Why is it only drop down lists that give me this problem ?
I am using SF 3.38 build 4333 and GNU Fortran 14.1.0 on a Windows 10 desktop

Thanks, Robert

Re: AppGraphics Drop Down List getdropdownlisttext function not working

Robert,

My guess, based on your code and description, is that a deadlock occurs when requesting text from the control while inside a callback.  If the main program requested the text, I'm guessing it would work.  But... it should work the way you have it as well.  If you're seeing something similar with the multiline textbox, I'm sure it's the same deadlock.

I'll look into it this weekend and push out a fix as soon as I can.

Jeff Armstrong
Approximatrix, LLC