forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Splash window - how to do it?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
rudnei



Joined: 29 Dec 2011
Posts: 34

PostPosted: Fri Oct 20, 2017 12:48 am    Post subject: Splash window - how to do it? Reply with quote

Hi,
I am trying to display a splash image (JPG) for a few seconds before the main application window/menus/etc are built and displayed, and then the splash window should be automagically destroyed.

I tried the following, but it doesn't work the way I want:

! Exibe imagem de abertura
rslt=winio@('%ww[topmost,naked]%im[abertura]%lw',janela_abertura)

! Início
nome_arquivo = ' '
call inicializar()

! destroi tela de abertura
call sleep@(5)
janela_abertura=0
call window_update@(janela_abertura)

! Montagem da interface gráfica
rslt = winio@('%ww%ca[FluxoViz]&')
rslt = winio@('%dr&',le_arquivo_largado)
rslt = winio@('%ft[Arquivo FLX][*.flx]&')
...
rslt = winio@('%`^gr[black,rgb_colours]&',painel%xmax-painel%xmin+1,painel%ymax-painel%ymin+1, &
id_painel_de_situacao,painel_de_situacao)
...


Any ideas how to solve this problem?

Cheers
Rudnei
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Oct 20, 2017 4:53 am    Post subject: Reply with quote

This may be more than you want, but this is how I do mine.

The callback "button1" returns a -1.
Code:

   SUBROUTINE SPLASH_SCREEN (SPLASH_WINDOW,SPLASH_HANDLE,TITLE_LINE,LICENSED_TO,&
                CUSTOMER_NAME,BUILD_DATE_TIME,appfolder,current_dir,sw_version,delay_time)
   USE MSWIN
   INTEGER*4 SPLASH_WINDOW,SPLASH_HANDLE
   CHARACTER*(*) TITLE_LINE,LICENSED_TO,CUSTOMER_NAME,BUILD_DATE_TIME,appfolder,current_dir,sw_version
   INTEGER*4 K
   integer,external:: button1
   real*8:: delay_time
   k = winio@("%ww[no_edge,no_caption,no_maxbox,no_minbox,topmost]&") !
   k = winio@("%fn[Times New Roman]%bf%ts&",2.0d0)
   k = winio@("%bg[red]%tc[yellow]&")
   k = winio@("%cn%bm[cjdbitmap]&") ! included as a resource IN THE MAIN
   k = winio@("%ff%ob[invisible]&") ! go past the end of the BMP and start a box which is invisible
   k = winio@("%cn%ws%nl&",TRIM(TITLE_LINE)) ! centered
   k = winio@("%cn(C) Copyright 1985-2016%nl%cnCJD Software%nl&") ! centered
   k = winio@("%cnAll Rights Reserved%nl&") ! centered
   k = winio@("%ts&",1.5d0) ! scale the following font items
   k = winio@("%cn%ws%nl&",trim(licensed_to))  ! centered
   k = winio@("%cn%ws%nl&",trim(customer_name))
   k = winio@("%cn%ws%nl&",trim(build_date_time))
!   k = winio@("%fn[Courier New]%bf&")
   k = winio@("%cnSW %ws Installed: %ws%nl&",trim(sw_version),trim(appfolder))
   k = winio@("%cnRunning in: %ws%nl&",trim(current_dir))
   k = winio@("%cb&") ! close the box
   k = winio@("%hw&",splash_window)
   k = winio@("%lw&",splash_handle) ! return the handle so we can close this in a few seconds
   k = winio@("%dl&",delay_time,button1) ! this closes the window after the delay timer expires
   k = winio@(' ')
   return
   end
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Oct 20, 2017 4:55 am    Post subject: Reply with quote

Rudnei,

Missed hyphen in the code was the reason of crash of rocket in 1962 which in present prices had cost around 1 B dollars.

This time you just missed a dot after number 5. Smile

Yea, even 50 year later Fortran still sucks at this.

Compiler diagnostics with /debug /check also missed that despite this is the best diagnostical compiler. Probably there still exist some tricky compiler switch to catch that error but definitely those two must do that. I'd consider it an error.

This is why we need more users. With critical thinking.

Reproducer:
Code:
i=winio@('%ww[topmost,naked]%im[abertura]%es%lw',ilw)
call sleep@(5.)  ! not sleep@(5)
ilw  = 0
call window_update@(ilw)
End

Resources
abertura   image orig.png
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Oct 20, 2017 5:53 pm    Post subject: Reply with quote

This is the operative code for my splash screen generator:

Code:
       COMMON  /SPLASH/       ICTRL
       COMMON  /Spl_Hnd/      iSplash_Wnd, jSplash_Wnd, NoInc
       ! various things in between
       ICTRL = 1
       NoInc = 255
       Delta_Time = 2.0D0/255.0D0
       IB=WINIO@('%ww[no_border,no_caption,no_maxminbox,topmost,'//     &
     &           'toolwindow,no_frame]&')
       IB=WINIO@('%^bm[SPLASHBMP]&','EXIT')
       IB=WINIO@('%lc%hw&', iSplash_Wnd, jSplash_Wnd)
       IB=WINIO@('%dl%lw',Delta_Time,KOUNTER,ictrl)

       RETURN
       END


KOUNTER is an INTEGER FUNCTION that counts down changing the splash opacity so it fades away:

Code:
       INTEGER FUNCTION KOUNTER()
C      --------------------------
       COMMON  /SPLASH/       ICTRL
       COMMON  /Spl_Hnd/      iSplash_Wnd, jSplash_Wnd, NoInc
       LOGICAL IA, SetWindowOpacity
       IF (NoInc .GE. 1) THEN
           IA=SetWindowOpacity(jSplash_Wnd, NoInc)
           NoInc = NoInc-1
           KOUNTER=1
           ELSE
           ICTRL = 0
           KOUNTER=0
           ENDIF
       RETURN
       END


and because this predates the incorporation of transparency in Clearwin+, it employs the code posted by another contributor (modified a tiny bit by me):

Code:
      logical function SetWindowOpacity(hWnd, alpha)
C     ----------------------------------------------
!     Set opacity level for a window (call after window creation) -
!     automatically sets appropriate extended style and sets opacity 
!     from 0 (transparent) to 255 (no transparency).

      use mswin
      integer, parameter:: WS_EX_LAYERED = Z'00080000'
      integer, parameter:: LWA_COLORKEY  = Z'00000001'
      integer, parameter:: LWA_ALPHA     = Z'00000002'
      STDCALL SetLayeredWindowAttributes 'SetLayeredWindowAttributes'
     &         (VAL, VAL, VAL, VAL) : LOGICAL*4
      integer, intent(in):: hWnd
      integer, intent(in):: alpha

      integer:: attrib, i
   
  ! Get current window attributes to ensure WS_EX_LAYERED extended style is set
      attrib = GetWindowLong(hWnd, GWL_EXSTYLE)
      if (IAND(attrib,WS_EX_LAYERED) /= WS_EX_LAYERED) then
         i = SetWindowLong(hWnd, GWL_EXSTYLE, IOR(attrib,WS_EX_LAYERED))
         end if

  ! Set layered window alpha value
      SetWindowOpacity = SetLayeredWindowAttributes
     &           (hWnd, 0, CORE1(LOC(alpha)), LWA_ALPHA)
      end function SetWindowOpacity


The persistence of vision effect makes dark splashes appear to be visible some time after they have actually disappeared.

It is also useful to kill off the splash if the main application window has fully loaded, especially if it loads with a pre-existing 'document', which is done by setting the window handle (ictrl in this case) to zero.

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Oct 20, 2017 8:00 pm    Post subject: Reply with quote

Eddie
I used your nice method in some my 32 bit codes but when converting to 64 bit I got a problem with Windows API function and there was no time to investigate substitution. Have you solved this?
Back to top
View user's profile Send private message
rudnei



Joined: 29 Dec 2011
Posts: 34

PostPosted: Fri Oct 20, 2017 9:08 pm    Post subject: Reply with quote

Many thanks to all who replied!
Cheers
Rudnei
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Oct 21, 2017 1:42 pm    Post subject: Reply with quote

Dan,

From version 7.00, Paul added opacity setting to Clearwin+ (see the ENH file, item 354 and following) thus:

INTEGER FUNCTION SET_OPACITY@(Opacity)
INTEGER opacity

which affect the current drawing surface, and presumably work in 64 bit mode.

The routine affects the current drawing surface, so if your splash screen is the only surface in view, presumably its opacity is set. What I am doing, however, is to build my main application screen 'behind' the splash, and I worked out that I would probably have to combine SELECT_GRAPHICS_OBJECT@ with the splash display handle before using SET_OPACITY@, and for a variety of reasons I didn't modify my code to suit.

One of the reasons being that I don't use 64-bit, having no need, and a second reason being that in maintaining that application for academic use I'm using a pre 64-bit licensed version of FTN95 (v6.10, actually).

In the countdown routine I would expect to replace

Code:
           IA=SetWindowOpacity(jSplash_Wnd, NoInc)


with

Code:
           IB = SELECT_GRAPHICS_WINDOW@(jSplash_Wnd)
           IA = SET_OPACITY@ (NoInc)


(and dump the custom routine) but I haven't got that far yet. It would avoid the call in the custom opacity setting routine and rely instead on how Paul implemented it.

Eddie
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Oct 21, 2017 1:55 pm    Post subject: Reply with quote

In my eagerness, I suggested something that doesn't work, sorry. I suspect that there are limitations in the call to SetLayeredWindowAttributes when used in 64 bit mode.

Eddie
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Oct 22, 2017 6:03 am    Post subject: Reply with quote

Still thanks for tries, Eddie

/* Meantime another way of making splash screen I posted in 64bit section based on OpenGL. It works on all other computers but mine main PC last two days.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group