Splash Screen for Startup

Splash Screen for Startup

Postby Jimmy » Mon Oct 24, 2022 5:19 am

hi,

is there a FiveWin Sample using a Splash Screen :?:

Code: Select all  Expand view
  ON INIT CreateScreenSplash( "Fill1StGrid('" + cLogic + "," + cuseF12 + "')" )

in MAIN call this ( Note Parameter )
Code: Select all  Expand view
PROCEDURE CreateScreenSplash( cFormRun )
LOCAL hBitmap, Image_Width, Image_Height, Image_BackColor
LOCAL nDelaySeconds   := 7
LOCAL nAnimateSeconds := 2

   DEFINE WINDOW SplashForm  AT 0, 0  WIDTH Image_Width HEIGHT Image_Height TITLE 'Splash' ;
         NOCAPTION  NOSYSMENU NOSIZE NOMINIMIZE NOMAXIMIZE ;
         TOPMOST ;
         BACKCOLOR Image_BackColor ;
         ON INIT &cFormRun      // this will call "real INIT" in Main

      SET WINDOW SplashForm TRANSPARENT TO COLOR Image_BackColor
      @ 10, 00 IMAGE Image_1 PICTURE "MYSPLASH" ON CLICK MsgInfo( "Splash Image" ) WIDTH Image_Width HEIGHT Image_Height // STRETCH        
      // @ 76, 10 PROGRESSBAR ProgressBar_1 RANGE 0, 1 WIDTH Image_Width - 20 HEIGHT 20

      @ Image_Height - 4, 0 PROGRESSBAR ProgressBar_1 RANGE 0, 1 WIDTH Image_Width HEIGHT 3        
      SET PROGRESSBAR ProgressBar_1 OF SplashForm ENABLE MARQUEE UPDATED 10

   END WINDOW

   ON KEY ESCAPE OF SplashForm ACTION Domethod( "SplashForm", "Release" )
   CENTER WINDOW SplashForm
   ACTIVATE WINDOW SplashForm

RETURN
Last edited by Jimmy on Mon Oct 24, 2022 8:01 am, edited 1 time in total.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Splash Screen for Startuo

Postby nageswaragunupudi » Mon Oct 24, 2022 5:53 am

Searching for the word "splash" in the programs in fwh\source folder, we find

1) MsgLogo( cImageFile, [nSeconds], [lTransparent] ) // old
2) MsgSplash( cImageFile, [nSeconds], [bAction], [lTransparent] )

Using bAction parameter, we can do silent tasks like connecting to server, opening files, etc (without any screen activity) and be ready by the time splash image is closed.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Splash Screen for Startuo

Postby nageswaragunupudi » Mon Oct 24, 2022 6:44 am

Sample usage:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oCn, oRs

   MsgSplash( "c:\fwh\bitmaps\pngs\2.png", 2, <||
      oCn   := maria_Connect( "208.91.198.197,fwhdemo,gnraofwh,Bharat@1950" )
      if oCn != nil
         oRs   := oCn:RowSet( "select * from customer" )
      endif
      return nil
      > )

   if oRs != nil
      XBROWSER oRs SETUP ( oBrw:lVThumbTrack := .t. )
      oRs:Close()
      oCn:Close()
   endif

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Splash Screen for Startuo

Postby Silvio.Falconi » Mon Oct 24, 2022 8:00 am

nageswaragunupudi wrote:Sample usage:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oCn, oRs

   MsgSplash( "c:\fwh\bitmaps\pngs\2.png", 2, <||
      oCn   := maria_Connect( "208.91.198.197,fwhdemo,gnraofwh,Bharat@1950" )
      if oCn != nil
         oRs   := oCn:RowSet( "select * from customer" )
      endif
      return nil
      > )

   if oRs != nil
      XBROWSER oRs SETUP ( oBrw:lVThumbTrack := .t. )
      oRs:Close()
      oCn:Close()
   endif

return nil
 


Image


yes but if you move the mouse into Msgsplash the mouse erase the image, this was an error allready advice from many years
Last edited by Silvio.Falconi on Mon Oct 24, 2022 8:06 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Splash Screen for Startup

Postby nageswaragunupudi » Mon Oct 24, 2022 8:05 am

yes but if you move the mouse into Msgsplash the mouse erase the image, this was an error allready advice from many years

Yes, important point.
We will take care of this.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Splash Screen for Startup

Postby TimStone » Mon Oct 24, 2022 6:17 pm

Silvio brings up an interesting behavior.

If I have a screen with a series of checkboxes. If I check one with a mouse click, the captions on the other ones disappears. Moving the mouse around, or clicking outside the checkboxes, might bring them back.

I noticed this several years back, then it disappeared, and in recent versions it is back.

What should I look for in my code to isolate and correct this behavior ?

I'm using the latest build of FWH, with Microsoft Visual Studio Community. My resources are all in an .rc file.

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Splash Screen for Startup

Postby Antonio Linares » Mon Oct 24, 2022 6:57 pm

Dear Tim,

I think such behavior happens cause the size of the checkboxes.

You have to design them in a way that they don't overlap
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Splash Screen for Startup

Postby TimStone » Mon Oct 24, 2022 7:29 pm

Antonio,

One of the advantages of using an .rc with my application, and hand coding them, is that I know the exact size of each box.

If I have 5 check boxes vertically, and each is the same size, with space between each row, and absolutely no overlap, I still have the problem.

If I check on box one, then the text for all 4 may disappear.

I know it is not because of overlapping boxes.

Here is an example: The Dialog is 835 characters wide.

Code: Select all  Expand view

    CONTROL         "Tax",496,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,690,95,30,13
    CONTROL         "Sublet",497,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,725,95,30,13
 


The Tax checkbox starts at 690, and has a length of 30. Thus it ends at 720. The Sublet starts 5 spaces later, at 725, and extends for 30 spaces. It ends at 755, and thus there are 80 spaces open to the right.

Click on tax, the checkmark appears in the box, and the word Tax disappears.
Click on Sublet, the checkmark appears in the box, and the word Sublet disappears. The word Tax then reappears.

I have the same result if boxes are vertical. It would appear that the checkbox control does not refresh the caption value. However, if I issue a dialog refresh command, like when a record is saved after editing, it comes back.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Splash Screen for Startup

Postby TimStone » Tue Oct 25, 2022 12:29 am

Here is another example. This is a printer selection control.

This is the RC. Note we are using Radio buttons this time. They are vertically stacked. The first one starts at position 10, and is 12 points high. So it goes to 22. The next one is at row 25. I use 15 point line spacing for all my dialogs and everything works fine except the behavior on the checkbox and radio controls when clicking one.
Code: Select all  Expand view

PRNSELW DIALOG 0, 0, 230, 90
STYLE  WS_POPUP | WS_CAPTION
CAPTION "Printer Selection Options"
{
    CONTROL         "Use DEFAULT printer",353,"Button",BS_AUTORADIOBUTTON,57,10,108,12
    CONTROL         "Select an ALTERNATE printer",354,"Button",BS_AUTORADIOBUTTON,57,25,158,12
    PUSHBUTTON      "",350,35,40,40,40
    PUSHBUTTON      "",351,95,40,40,40
    PUSHBUTTON      "",352,155,40,40,40
}
 


Here is the .prg code that uses this dialog:
Code: Select all  Expand view

FUNCTION prnsel

    // Declare EXTERNAL variables
  LOCAL ofBrush
    MEMVAR oWnd, lGxPrsnt
    // Declare LOCAL variables
    LOCAL prnmeth := 0, oDlg, oRadOpt, lView := .F. , lPrint := .F. , nPrn := 1
    LOCAL cTitle := "Printer Selection Options"
    lGxPrsnt := .T. // Assign static values

    // Create the dialog
  IF cWSshow = "W"
        DEFINE DIALOG oDlg RESOURCE "PRNSELw" BRUSH oBrush transparent TITLE cTitle
    ELSE
        DEFINE DIALOG oDlg RESOURCE "PRNSEL" BRUSH oBrush transparent TITLE cTitle
  ENDIF

    // Create the radio control
    REDEFINE RADIO oRadOpt VAR nPrn ID 353, 354 OF oDlg
    // Create the button controls
    REDEFINE BTNBMP ID 350 of oDlg RESOURCE "HRZMIN" PROMPT "View" NOBORDER TRANSPARENT ;
        ACTION ( lView := .T., oDlg:End ) MESSAGE "Preview the report, with an option to print"
    REDEFINE BTNBMP ID 351 of oDlg RESOURCE "HRPRINT" PROMPT "Print" NOBORDER TRANSPARENT;
        ACTION ( lPrint := .T., oDlg:End ) MESSAGE "Print the report without previewing"
    REDEFINE BTNBMP ID 352 of oDlg RESOURCE "HREXIT" PROMPT "Cancel" NOBORDER TRANSPARENT;
        ACTION ( oDlg:End ) MESSAGE "Cancel the print operation "

    // Activate the dialog
    ACTIVATE DIALOG oDlg CENTERED

    IF lView .AND. nPrn = 2 // View and select printer
        prnmeth := 1
    ELSEIF lView .AND. nPrn = 1 // View and default printer
        prnmeth := 2
    ELSEIF lPrint .AND. nPrn = 2 // Print with selection
        prnmeth := 3
    ELSEIF lPrint .AND. nPrn = 1 // Print to default
        prnmeth := 4
    ENDIF

RETURN ( prnmeth )
 
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Splash Screen for Startup

Postby Jimmy » Tue Oct 25, 2022 9:11 am

hi,

Back to Splash Screen

i have look at MsgSplash() / MsgLogo()
both use Sleep( nSeconds * 1000 ) but what when bAction is ready/not ready within nSeconds :?:

---

when call a INIT it will "end" before Display Window
call a INIT from INIT will "end" when 2nd INIT is "ready"

Code: Select all  Expand view
STATIC lStop := .F.
PROCEDURE Main( cPath, cLangCode, cCodepage )
   DEFINE WINDOW oWnd
      oExplorer := TExplorer() :New( oWnd, nTop, nLeft, nWidth - 20, cPath, nIcoLarge, nIcoSmall )

   ACTIVATE WINDOW oWnd ON RESIZE DoResize( oWnd, oExplorer ) ON INIT DoSplash( oWnd, oExplorer ) CENTER


Code: Select all  Expand view
PROCEDURE DoSplash( oWnd, oExplorer )
   oWnd:hide()   // hide Main Window
   lStop := .F.
   DEFINE WINDOW oDlg FROM nTop, nLeft TO nTop + nSizeH, nLeft + nSizeW PIXEL TITLE "welcome to TGrid()"
      // place here Logo or some Animation
      DEFINE TIMER oTimer INTERVAL 100 OF oDlg ACTION TestBreak( oDlg )
      ACTIVATE TIMER oTimer

   ACTIVATE WINDOW oDlg CENTER  ON INIT NowBuildGrid( oDlg, oExplorer )

   oWnd:show()   // Show  Main Window now
   oWnd:SetFocus()


Code: Select all  Expand view
PROCEDURE NowBuildGrid( oDlg, oExplorer )
   // fill Array and build Grid
   oExplorer:FillGrid( oDlg )
RETURN


Code: Select all  Expand view
METHOD FillGrid( oWnd ) CLASS TExplorer
   FOR ii := 1 TO nMax
      // long loop
   NEXT
   // now Stop Splash Screen
   StopSplash()


Code: Select all  Expand view
PROCEDURE TestBreak( oDlg )
   IF lStop = .T.
      oDlg:End()
   ENDIF
RETURN


Code: Select all  Expand view
PROCEDURE StopSplash()
   lStop := .T.
RETURN
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Splash Screen for Startup

Postby nageswaragunupudi » Tue Oct 25, 2022 9:53 am

what when bAction is ready/not ready within nSeconds :?:


If bAction is finished in less than nSeconds, the program waits till nSecond are completed.
If bAction takes longer time than nSeconds, the dialog is closed soon after execution of bAction is finished.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Splash Screen for Startup

Postby Jimmy » Tue Oct 25, 2022 11:47 am

hi,
nageswaragunupudi wrote:If bAction is finished in less than nSeconds, the program waits till nSecond are completed.
If bAction takes longer time than nSeconds, the dialog is closed soon after execution of bAction is finished.

that is what i say as i can be 1 Sec. up to 5 Min ...

---

have forgot to say in last CODE

Code: Select all  Expand view
oExplorer:FillGrid( oDlg )


Code: Select all  Expand view
METHOD FillGrid( oWnd ) CLASS TExplorer
   ...
   ::oProgress := TProgress() :New( 0, 0, oWnd, 0,,, .T., .F., oWnd:nWidth - 10, 8 )
   ...
   // long loop
   FOR ii := 1 TO nMax
      IF ( ii % nEvery ) = 0
         ::oProgress:StepIt()
      ENDIF
      ...
   NEXT
   // now Stop Splash Screen
   StopSplash()

i also can show running Progressbar on Splash Screen when build Grid

my Question is : how to build a "general" Modul which "react" ( UserDef Event ? ) like my Sample :idea:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Splash Screen for Startup

Postby nageswaragunupudi » Tue Oct 25, 2022 12:06 pm

We are planning to provide an advanced splash screen.
1. Fix the issue pointed our by Mr. Silvio
2. Ability to provide any animation by the user.
You can ask for anything else.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Splash Screen for Startup

Postby Jimmy » Tue Oct 25, 2022 12:57 pm

hi,
nageswaragunupudi wrote:You can ask for anything else.

i like to request :
Progressbar
Codeblock Slot to EVAL() by TIMER
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Splash Screen for Startup

Postby Jimmy » Thu Oct 27, 2022 12:24 pm

hi,
nageswaragunupudi wrote:You can ask for anything else.

like this
Image
like MsgSplash() it make Image "transparent" and Progressbar are show while Data are loading at Start

btw. does Fivewin have Function like "BOS TAURUS" Contribution to use hDC "direct" to "paint" :?:

i want to use it in ON PAINT
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests