Page 2 of 2
Re: only Progressbar
Posted: Mon Apr 13, 2020 5:26 am
by AUGE_OHR
hi,
i got a Solution using a Field-wide STATIC
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 ..."
btw. have try #include "hbxpp.ch" and LIB and got same Error "only Panel ..."
have to try if Concept work in "big" App ...
Re: only Progressbar
Posted: Mon Apr 13, 2020 11:07 am
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
Maybe somethink like that
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
Re: only Progressbar
Posted: Mon Apr 13, 2020 1:43 pm
by movilceles
Hello, modify your example and now it works.
Re: only Progressbar
Posted: Mon Apr 13, 2020 9:20 pm
by AUGE_OHR
hi,
thx for Demo, i will study it
Re: only Progressbar
Posted: Mon Apr 13, 2020 9:51 pm
by AUGE_OHR
hi edk,
i have study your Sample and your Solution with Macro
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

Re: only Progressbar
Posted: Mon Apr 13, 2020 11:10 pm
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.
Re: only Progressbar
Posted: Mon Apr 13, 2020 11:32 pm
by edk
AUGE_OHR wrote: ↑Mon Apr 13, 2020 9:51 pm
hi edk,
i have study your Sample and your Solution with Macro
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
Try hb_serialize()
Or hb_valtoexp()
https://hmgforum.com/viewtopic.php?p=60100#p60100
Or use blockcode as parameter then on init eval ( bCode )
Re: only Progressbar
Posted: Tue Apr 14, 2020 4:10 am
by AUGE_OHR
hi,
AHA ... i remember ...
your Solution with Macro and Progressbar are GREAT ... give me new Idea what can do ON INIT
