Hello to anyone!
I need to advise how to bring dialog windows defined in a subroutine to main calling program (thanks in advance).
DESCRIPTION: I defined a main window in the main program, where the user must define three variables (VARIABLE1: input file name with input data, VARIABLE2: output file name, where the new data will be written and VARIABLE3: to change or not the signs in the output data). When this is specified, all 3 variables are passed to a subroutine, which is called from main program and which - in fact - does the real job.
Since for the subroutine it takes some time (around 35 minutes) to finish the job, it is necessary to define a progress bar, otherwise the user sees nothing in the main window and can have such feeling that the program does not work (although it works). So, I defined within the called subroutine a progress bar window and - when subroutine finishes - a message window that the job is done and then it should be returned to main window of the main program. However, these windows are nowhere seen and never displayed.
The last iowin function in main program (placed directly before calling the subrouitine is:
1 ans=winio@('%3nl%taChange signs for DX and DY in the output TXT file? (y=yes, n=no)%`5.2ls',change,3l,selection)
The three iowin functions in the called subroutine, placed before the real job starts - it means before an outer DO loop) are:
ans=winio@('%ca[Progress bar]&')
ans=winio@('Current status ... %2nl&')
ans=winio@('%60br&',bar_fill,RGB@(255,255,0))
then immediately come three DO loops:
First: do i = 1,I_Pocet_X !outer DP loop ! ! defining the step of the progres bar (corresponds to 1%) ! krok_bar_fill = 100.0/real(I_Pocet_X)
if (i.eq.1) then
bar_fill=0.0
else
bar_fill = bar_fill+krok_bar_fill
end if
! ! calling progress bar update for the value bar_fill (up to value 1) ! --------------------------------------------------------- ! do while (bar_fill.lt.1.0) !beginning DO WHILE
CALL window_update@(bar_fill)
if (i.eq.1) then
I_X = I_Xmin
else
I_X = I_X + I_X_krok
end if
Inner1: do j = 1, I_Pocet_Y ! first inner DO loop - beginning
if (j.eq.1) then
I_Y = I_Ymin
else
I_Y = I_Y + I_Y_krok
end if
rewind 3
Inner2: do n = 1, k ! second inner DO loop - beginning
if (n.lt.8) then
read (3,*) riadok
cycle
else
read (3,*) I_XX, I_YY, DDX, DDY
end if
if (I_X.eq.I_XX.and.I_Y.eq.I_YY) then
if (selection.eq.2) then
write (4,37) I_XX, I_YY, DDX, DDY
37 format (I8,',',I7,',',F6.2, ',',F6.2)
else
DDX = -1.0DDX
DDY = -1.0DDY
write (4,95) I_XX, I_YY, DDX, DDY
95 format (I8,',',I7,',',F6.2, ',',F6.2)
end if
exit
else if (n.eq.k) then
write (4,33) I_X, I_Y, DX, DY
33 format (I8,',',I7,',',F6.2, ',',F6.2) end if
end do Inner2
end do Inner1
end do !end do loop DO WHILE, when bar_fill, is less than 1
end do First
close (3)
close (4)
! ! Message window - conversion done ! w=200 h=20 ans=winio@('%sz&',w,h) ans=winio@('%ca%bf%fn[Arial][Program DATA_CONV - Info]&') ans=winio@('%3nl%ta%sfData formatting done %2nl %cn9^bt [&Finish]','OK')
end subroutine