only Progressbar

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: only Progressbar

Post by AUGE_OHR »

hi,

i got a Solution using a Field-wide STATIC :D

Code: Select all

PROCEDURE DEMO1()
LOCAL cFileName       := "COLORS.BMP"
LOCAL nDelaySeconds   := 7
LOCAL nAnimateSeconds := 2

   hb_threadStart( @DEMO2())
   hb_threadStart( @CreateScreenSplash(), cFileName, nDelaySeconds, nAnimateSeconds )
   hb_threadWaitForAll()

RETURN

Code: Select all

PROCEDURE DEMO2()
   lStop := .T.
   ACTIVATE WINDOW Form2
   lStop := .F
RETURN

Code: Select all

PROCEDURE CreateScreenSplash( cFileName, nDelaySeconds, nAnimateSeconds )
      ...
      DEFINE TIMER Timer_1 INTERVAL 10 ACTION { || TestBreak( ThisWindow.Name ) }
   END WINDOW
   ACTIVATE WINDOW SplashForm
RETURN
   
PROCEDURE TestBreak()
   IF lStop = .T.
      Domethod( "SplashForm", "Timer_1", "Release" )
      Domethod( "SplashForm", "Release" )
   ENDIF
RETURN
---

Progressbar now use MARQUEE while i´m still unable to access it from "other" Thread. :(

if i use HB_THREAD_INHERIT_PUBLIC as 1st Parameter with hb_threadStart() i got Error "only Panel ..." :o
btw. have try #include "hbxpp.ch" and LIB and got same Error "only Panel ..." :roll:

have to try if Concept work in "big" App ...
have fun
Jimmy
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: only Progressbar

Post by edk »

AUGE_OHR wrote: Sat Apr 11, 2020 5:18 pm hi,

i want to open a new Windows to show Thumbs.
while it take some time to load i want to show a Progressbar ... but how when "loading ..."

i don´t have a Progressbar on my "old" Windows when loading and new Window will not appear until all load ...
so "where" an "how" to use a Progressbar ... need a Idea :idea:
Maybe somethink like that :?: :idea:

Code: Select all

#include <hmg.ch>

Function Main

DEFINE WINDOW main AT 0 , 0 WIDTH GetDesktopWidth() HEIGHT 150 NOSYSMENU NOCAPTION
	DEFINE MAIN MENU
        DEFINE POPUP "Menu"
            MENUITEM "Thumbs" ACTION pBarForm ("ThumbsForm()")
            MENUITEM "Exit" ACTION ReleaseAllWindows()
        END POPUP
    END MENU

END WINDOW

main.Activate

Return
***************************************************************************
Function pBarForm( cFormRun )

DEFINE WINDOW pbar AT 210 , (GetDesktopWidth() - 550) / 2 WIDTH 550 HEIGHT 50 TOPMOST NOMINIMIZE NOMAXIMIZE NOSIZE NOSYSMENU NOCAPTION ON INIT &cFormRun ON RELEASE Nil ON PAINT nil

  @10,5 PROGRESSBAR bar RANGE 0, 100 WIDTH 540 HEIGHT 30
  
END WINDOW

pbar.bar.value:=0

pbar.Activate
 
Return
**************************************************************

Function ThumbsForm()
Local i, j, k := 0, cIname
DEFINE WINDOW thumbs AT 0 , 0 WIDTH 570 HEIGHT 600 TITLE "Thumbs"

	for i = 1 to 100
		DO EVENTS
		j := i%10
		IF j = 0
			j := 10
		ENDIF
		IF j = 1
			k++
		ENDIF
		cIname := "Image_" + AllTrim(Str( i ))
		@ (k * 55) - 50, (j * 55) - 50  IMAGE &cIname PICTURE "_TRACEPOINT" WIDTH 50 HEIGHT 50 TOOLTIP cIname
		pbar.bar.Value := i
		sleep(50)		//simulation of thumb creating (50 miliseconds)
	next i

	pbar.Release
	
END WINDOW
thumbs.center
thumbs.Activate
 
Return
Version with preview:

Code: Select all

#include <hmg.ch>

Function Main

DEFINE WINDOW main AT 0 , 0 WIDTH GetDesktopWidth() HEIGHT 150 NOSYSMENU NOCAPTION
	DEFINE MAIN MENU
        DEFINE POPUP "Menu"
            MENUITEM "Thumbs" ACTION pBarForm ("ThumbsForm()")
            MENUITEM "Exit" ACTION ReleaseAllWindows()
        END POPUP
    END MENU

END WINDOW

main.Activate

Return
***************************************************************************
Function pBarForm( cFormRun )

DEFINE WINDOW pbar AT 210 , (GetDesktopWidth() - 550) / 2 WIDTH 550 HEIGHT 50 TOPMOST NOMINIMIZE NOMAXIMIZE NOSIZE NOSYSMENU NOCAPTION ON INIT &cFormRun ON RELEASE Nil ON PAINT nil

  @10,5 PROGRESSBAR bar RANGE 0, 100 WIDTH 540 HEIGHT 30 SMOOTH
  
END WINDOW

pbar.bar.value:=0

pbar.Activate
 
Return
**************************************************************

Function ThumbsForm()

DEFINE WINDOW thumbs AT 0 , 0 WIDTH 570 HEIGHT 600 TITLE "Thumbs" ON INIT MakeThumbs()
	
END WINDOW
thumbs.center
thumbs.Activate
 
Return

FUNCTION MakeThumbs()
Local i, j, k := 0, cIname

	for i = 1 to 100
		DO EVENTS
		j := i%10
		IF j = 0
			j := 10
		ENDIF
		IF j = 1
			k++
		ENDIF
		cIname := "Image_" + AllTrim(Str( i ))
		@ (k * 55) - 50, (j * 55) - 50  IMAGE &cIname OF thumbs PICTURE "_TRACEPOINT" WIDTH 50 HEIGHT 50 TOOLTIP cIname
		pbar.bar.Value := i
		sleep(50)		//simulation of thumb creating (50 miliseconds)
		
	next i

	pbar.Release

RETURN
Last edited by edk on Mon Apr 13, 2020 2:56 pm, edited 1 time in total.
movilceles
Posts: 20
Joined: Sun Dec 04, 2016 1:43 pm
DBs Used: DBF
Location: Murcia - España

Re: only Progressbar

Post by movilceles »

Hello, modify your example and now it works.
Attachments
MODIFICADO.zip
(24.72 KiB) Downloaded 152 times
Celes
Saludos / Regards :P - :idea: Cuanto mas simple mejor !! / The simpler the better !!
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: only Progressbar

Post by AUGE_OHR »

hi,

thx for Demo, i will study it
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: only Progressbar

Post by AUGE_OHR »

hi edk,

i have study your Sample and your Solution with Macro :D

Code: Select all

pBarForm ("ThumbsForm()")

Function pBarForm( cFormRun )
   ... ON INIT &cFormRun
now i have Problem to use this Technique when have Parameter for Function

Code: Select all

pBarForm ("ThumbsForm(a,b,c)")
pBarForm ("ThumbsForm()",a,b,c)
need some more help with Macro with Parameter, thx

---

ok i understand that it must be a String

Code: Select all

   pBarForm( "THUMBS('"+cPath +"')" )
but now the Question what about Array or Logic as Parameter :idea:
have fun
Jimmy
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

Re: only Progressbar

Post by jairpinho »

hello team, following this subject maybe what I have been trying for a long time would be to progressively follow the whole process of executing a function called with or without parameters, because today the user comes to think that the system has stopped because some reporting processes and sql search takes a little and I have nothing to show this process for the user to know that he must wait and the system he is processing, I will wait for the final results but the examples already posted have already helped a lot for understanding thanks.
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: only Progressbar

Post by edk »

AUGE_OHR wrote: Mon Apr 13, 2020 9:51 pm hi edk,

i have study your Sample and your Solution with Macro :D

Code: Select all

pBarForm ("ThumbsForm()")

Function pBarForm( cFormRun )
   ... ON INIT &cFormRun
now i have Problem to use this Technique when have Parameter for Function

Code: Select all

pBarForm ("ThumbsForm(a,b,c)")
pBarForm ("ThumbsForm()",a,b,c)
need some more help with Macro with Parameter, thx

---

ok i understand that it must be a String

Code: Select all

   pBarForm( "THUMBS('"+cPath +"')" )
but now the Question what about Array or Logic as Parameter :idea:
Try hb_serialize()
Or hb_valtoexp()
http://hmgforum.com/viewtopic.php?p=60100#p60100
Or use blockcode as parameter then on init eval ( bCode )
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: only Progressbar

Post by AUGE_OHR »

hi,
edk wrote: Mon Apr 13, 2020 11:32 pm Try hb_serialize()
Or hb_valtoexp()
http://hmgforum.com/viewtopic.php?p=60100#p60100
Or use blockcode as parameter then on init eval ( bCode )
AHA ... i remember ...

your Solution with Macro and Progressbar are GREAT ... give me new Idea what can do ON INIT :idea:
have fun
Jimmy
Post Reply