FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Possible to change Bar-colors/size at runtime ? (solved)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Possible to change Bar-colors/size at runtime ? (solved)
Posted: Sun Aug 03, 2008 10:44 AM
Hello,

for the Vtools, i startet with the Bar-test.
There are some problems :

1. I want to change the Bar-Color from inside a Dialog with a button.
oBar:bClrGrad ( Window-Bar oBar ) has to be red now.
But the button doesn't change the color.



REDEFINE BUTTONBMP oBtn1  ID 10 OF oDlg ;
ACTION ( oBar:bClrGrad = { | | { { 0.50,128, 16777215 },;
              { 0.50, 16777215, 128 } } }, oBar:Paint() ) ;
BITMAP "New" PROMPT "" TEXTRIGHT
oBtn1:cToolTip =  { "Changing Windows" + CRLF + ;
                         "Bar-Color","Bar-Color", 1, CLR_BLACK, 14089979 }


2. I wanted a buttonbar in the dialog
it was no problem before.
Now i get a error :

//----------------------------------------------------------------------------//

FUNCTION Tools(oBar)
local oDlg, oBar1, oLbx1, oBrush, oBtn1, oBtn2
   
DEFINE DIALOG oDlg RESOURCE "Tools" OF oWnd TITLE  "DBF-Structure"

DEFINE BUTTONBAR oBar1 OF oDlg SIZE 60, 60 2007 RIGHT
oBar1:bClrGrad = { | | { { 0.50,16054371, 8388608 }, ; 
                                    { 0.50,16054371, 8388608 } } }


There is a error :



Application
===========
Path and name: D:\T_STRUCTURE\struct.exe (32 bits)
Size: 1,567,744 bytes
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 08/03/08, 12:46:57
Error description: Error FiveWin/6 Cannot create window or control:
Class: TBAR
Caption:

System Error: Untergeordnetes Fenster kann nicht auf der obersten Ebene erstellt werden.

In english : child window cannot be created on the top level !

This message i had never before.

Stack Calls
===========
Called from: .\source\classes\WINDOW.PRG => WNDCREATEERROR(0)
Called from: .\source\classes\WINDOW.PRG => TBAR:CREATE(0)
Called from: .\source\classes\BAR.PRG => TBAR:NEW(0)
Called from: .\struct.PRG => TOOLS(60)
Called from: .\struct.PRG => (b)MAIN(32)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: .\struct.PRG => MAIN(49)

possible to solve the problems ?

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Possible to change Bar-colors at runtime ?
Posted: Sun Aug 03, 2008 10:57 AM
ukoenig wrote:2. I wanted a buttonbar in the dialog
it was no problem before.
Now i get a error :


Try defining your buttonbar in the ON INIT clause.

EMG
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Possible to change Bar-colors/size at runtime ? (solved)
Posted: Sun Aug 03, 2008 11:16 AM
Thank you very much
One problem solved.



ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON PAINT gradpaint2( hDC, oDlg ) ;
ON INIT NEW_DLGBAR(oDlg)

RETURN NIL   

// ---------------------------------

FUNCTION NEW_DLGBAR(oDlg)

DEFINE BUTTONBAR oBar1 OF oDlg SIZE 60, 60 2007 RIGHT ;

oBar1:bClrGrad = { | | { { 0.50,16054371, 8388608 }, ; 
                                    { 0.50,16054371, 8388608 } } } 

....
....
....

RETURN( NIL )


A color-change-test inside the dialog :

REDEFINE BUTTONBMP oBtn1 ID 10 OF oDlg ;
ACTION ( oBar1:bClrGrad = { | | { { 0.50,16054371, 8388608 }, ;
{ 0.50,16054371, 8388608 } } }, oBar1:Paint() ) ;
BITMAP "New" PROMPT "" TEXTRIGHT
oBtn1:cToolTip = { "Changing Dialog" + CRLF + ;
"Bar-Color","Bar-Color", 1, CLR_BLACK, 14089979 }

ERROR :

Application
===========
Path and name: D:\T_STRUCTURE\struct.exe (32 bits)
Size: 1,567,744 bytes
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 08/03/08, 13:36:40
Error description: Error BASE/1004 Class: 'NIL' has no exported method: BCLRGRAD
Args:
[ 1] = U

Stack Calls
===========
Called from: => BCLRGRAD(0)
Called from: .\struct.PRG => (b)TOOLS(124)
Called from: .\source\classes\BUTTON.PRG => TBUTTONBMP:CLICK(0)
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT(0)
Called from: .\source\classes\BUTTONB.PRG => TBUTTONBMP:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => SENDMESSAGE(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: .\struct.PRG => MAIN(49)

Maybe still a solution for the runtime-problem.
I want, that the user can test different styles and colours
for the bars in VTOOLS.

Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Possible to change Bar-colors/size at runtime ? (solved)
Posted: Sun Aug 03, 2008 12:17 PM
ukoenig wrote:Error description: Error BASE/1004 Class: 'NIL' has no exported method: BCLRGRAD
Args:
[ 1] = U


oBar1 is NIL. I strongly suggest to use -w2 compiler switch.

EMG
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Using extra dialog for new bar-test
Posted: Sun Aug 03, 2008 01:12 PM
Hello Enrico,

I changed from Red to Blue.
The result is shown in a extra dialog ( not runtime )



What do you think about this solution ?

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Possible to change Bar-colors/size at runtime ? (solved)
Posted: Sun Aug 03, 2008 01:14 PM

Uwe,

Please declare local oBar1 in FUNCTION NEW_DLGBAR()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Testing Gradients
Posted: Sun Aug 03, 2008 01:31 PM

Antonio,

thank You very much.

In all tests ( xbrowse, bars .... ) maybe it is better, to keep the old setting
and show changes in a extra dialog ?
The user can see the difference of the original and the changes.

As a sample : the original dialog shows the bar only RIGHT with Red color.
The test shows TOP and RIGHT in Blue.

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Possible to change Bar-colors/size at runtime ? (solved)
Posted: Sun Aug 03, 2008 03:41 PM
I am responding to this limited issue raised by Mr Uwe

>>
1. I want to change the Bar-Color from inside a Dialog with a button.
oBar:bClrGrad ( Window-Bar oBar ) has to be red now.
But the button doesn't change the color.
>>

At present, the code of bar.prg and btnbmp.prg does not allow change of gradient at runtime.
The following changes are needed to change the gradient color at runtime.


First in the application code :
the code:
ACTION ( oBar:bClrGrad = { | | { { 0.50,128, 16777215 },; 
              { 0.50, 16777215, 128 } } }, oBar:Paint() )

be changed as:
ACTION ( oBar:bClrGrad := { | | { { 0.50,128, 16777215 },; 
              { 0.50, 16777215, 128 } } }, oBar:Refresh() )
//  Here ':=" should be used but not '=' )


In the BtnBmp.Prg:

orginal code at Line 724
      GradientFill( ::hDC, 1, 0, ::nHeight, ::nWidth, Eval( ::bClrGrad, ::lMOver ) )

be changed as :
      GradientFill( ::hDC, 1, 0, ::nHeight, ::nWidth, Eval( ::oWnd:bClrGrad, ::lMOver ) )

In the Bar.Prg:

After line no: 751, before ::DispEnd( aInfo ), the following code is to be inserted:
   for n = 1 to Len( ::aControls )
      ::aControls[ n ]:Refresh()
   next

After doing the above changes, it is possible to change the gradient color at runtime.

Hope Mr. Antonio agrees with the above changes.
Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Bar-Gradients
Posted: Sun Aug 03, 2008 04:53 PM
Thank you very much.

I'm busy with testing.
I think, i finish the bar-modul at first,
then carry on with the rest.

Soon the first tests have good results.
It works fine with the color-selections.
There has to be a field for the source-result
like :

oBar:bClrGrad = { | | { { 0.50,16054371, 8388608 }, ;
{ 0.50, 8388608,16054371 } } }

This must be stored in a project-file.



When i close a Test-diolog, I will store the color-result
to the Dialog-bar ( Red )
After a new test it is possible to see the difference to the test,
done before.

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Changing Buttonbars at runtime
Posted: Sat Aug 09, 2008 03:06 PM

Hello,
to change a buttonbar in a clean way at runtime, seems
to be nearly impossible.
The old buttons are visible again with mouse-connection.
the old bar created before, is still active.
I have to find a different solution.

I wanted to use the solution from nageswaragunupudi.

nageswaragunupudi

i added the lines to Bar.prg
When i start my exe-file there is a error.


In the Bar.Prg:

After line no: 751, before ::DispEnd( aInfo ), the following
code is to be inserted:
Code:

for n = 1 to Len( ::aControls )
::aControls[ n ]:Refresh()
next
::DispEnd( aInfo )


When i start the application, an error occurs :

Application

Path and name: D:\T_BAR\bartest.exe (32 bits)
Size: 1,624,064 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 08/09/08, 16:35:19
Error description: Error BASE/1111 Argument error: LEN
Args:
[ 1] = U

Stack Calls

Called from: => LEN(0)
Called from: .\bar.PRG => GRADIENTFILL(892)

maybe the lines are inserted on a wrong position ?

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Possible to change Bar-colors/size at runtime ? (solved)
Posted: Sat Aug 09, 2008 03:14 PM

>>>
Called from: => LEN(0)
Called from: .\bar.PRG => GRADIENTFILL(892)
>>>
This means NIL is being passed on the GradientFill function instead of a valid Gradient Array.

Please check if you made all the corrections I posted earlier 'exactly' . I confirm it works for me here.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Error after link-change
Posted: Sat Aug 09, 2008 04:26 PM
Hello,

If found the ERROR

The reason is not the code change.

The error occurs, when i include bar.prg in the link file.
There is no syntax-error in the compile-run, only when i start the exe.

When bar.prg is used from Lib and not included in the link file, it works.
It seems, i cannot add the lines to the prg.

File stamp : BAR.prg / 29.418 / 30.07.2008

PRG = \
bar.PRG \ <====
btnbmp.PRG \
bartest.PRG

Maybe the file bar.prg is different to the library ?

As a test, i started a project with the FWH-sample TESTGRAD.prg

The same happend. When i start the EXE, i get the error.

I use a normal make-file :

#Borland make sample, (c) FiveTech Software 2005

HBDIR=d:\xharbour
BCDIR=d:\bcc55
FWDIR=d:\fwh

.path.OBJ = .\obj
.path.PRG = .\
.path.CH = $(FWDIR)\include;$(HBDIR)\include
.path.C = .\
.path.rc = .\

PRG = \
bar.PRG \
btnbmp.PRG \
testgrad.PRG <=== FWH-sample

PROJECT : testgrad.exe

testgrad.exe : $(PRG:.PRG=.OBJ) $(C:.C=.OBJ) testgrad.res
echo off
echo $(BCDIR)\bin\c0w32.obj + > b32.bc

# OBJ-Liste
# -------------
echo obj\bar.obj \
obj\btnbmp.obj \
obj\testgrad.obj, + >> b32.bc

echo testgrad.exe, + >> b32.bc
echo testgrad.map, + >> b32.bc

# Fivewin Lib`s für xHARBOUR
# --------------------------------------
.....
.....
.....


After a new design, the old bar is still visible in the dialog.
The new one is shown on top of the old one.



Regards Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion