Possible to change Bar-colors/size at runtime ? (solved)

Possible to change Bar-colors/size at runtime ? (solved)

Postby ukoenig » 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.

Image

Code: Select all  Expand view

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 :

Code: Select all  Expand view

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

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 :

Image

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 :lol:
Last edited by ukoenig on Sun Aug 10, 2008 2:11 pm, edited 2 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to change Bar-colors at runtime ?

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby ukoenig » Sun Aug 03, 2008 11:16 am

Thank you very much
One problem solved.

Image

Code: Select all  Expand view

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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Using extra dialog for new bar-test

Postby ukoenig » Sun Aug 03, 2008 1:12 pm

Hello Enrico,

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

Image

What do you think about this solution ?

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Antonio Linares » Sun Aug 03, 2008 1:14 pm

Uwe,

Please declare local oBar1 in FUNCTION NEW_DLGBAR()
regards, saludos

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

Testing Gradients

Postby ukoenig » Sun Aug 03, 2008 1: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby nageswaragunupudi » Sun Aug 03, 2008 3: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:
Code: Select all  Expand view
ACTION ( oBar:bClrGrad = { | | { { 0.50,128, 16777215 },;
              { 0.50, 16777215, 128 } } }, oBar:Paint() )

be changed as:
Code: Select all  Expand view
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
Code: Select all  Expand view
      GradientFill( ::hDC, 1, 0, ::nHeight, ::nWidth, Eval( ::bClrGrad, ::lMOver ) )

be changed as :
Code: Select all  Expand view
      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:
Code: Select all  Expand view
   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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Bar-Gradients

Postby ukoenig » Sun Aug 03, 2008 4: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.

Image

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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Changing Buttonbars at runtime

Postby ukoenig » Sat Aug 09, 2008 3: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby nageswaragunupudi » Sat Aug 09, 2008 3: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Error after link-change

Postby ukoenig » Sat Aug 09, 2008 4: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.

Image

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 56 guests