topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
ButtonBMP | aunque parezca mentira, sigo sin poder visualizar un buttonbmp como Dios manda. Tanto TEXT como BMP se pisan en el centro del Button y no consigo moverlos aun utilizando las 4 clausulas TEXTTOP, TEXT...
Los bitmap son 32x32 y perfectamente se arman si utilizo un BTNBMP
Revise los ejemplos de \Samples.
En mi PRG:
redefine Buttonbmp ob1 id 141 OF oDlg ACTION resumeag() bitmap 'Atencion' TEXTRIGHT PROMPT space(4)+"avisos"
redefine Buttonbmp ob2 id 202 OF oDlg ACTION odlg:end()bitmap 'Salir' PROMPT " Salir AHORA" TEXTRIGHT
oB1:cTooltip:= "Ver avisos pendientes"
oB2:cTooltip:= "Salir"
En mi RC:
PUSHBUTTON "Button", 141, 59, 270, 71, 44
PUSHBUTTON "Button", 202, 131, 270, 73, 42
Utilizo FWH2.7.... ¿hay problemas en esta versión con los buttonbmp?
Mil gracias.
LORENZO |
ButtonBMP | REDEFINE BUTTONBMP obtn[5] PROMPT "F5"+CRLF+ "Ex&trato" ID 4015 OF pfDlg BITMAP "PRINT" TEXTTOP CANCEL
Em PELLES :
Vert Alignment = TOP
Uso sem problemas
Aoki |
ButtonBMP de Rossini | Hola,
tengo el problema que con estos botones necesito hacer mas de una vez click con el raton sobre ellos para que se ejecute lo definido en ACTION, hay alguna solucion para ello?
saludos
Marcelo |
ButtonBMP de Rossini | Marcelo,
Te enviamos por email la clase de FWH, modificada compatible con la de Rossine para que la pruebes. Gracias. |
ButtonBMP de Rossini | Antonio:
Seria tabn amable de enviarme la clase Rosine a mi
tambien.
Muchas gracias.
Ruben Fernandez |
ButtonBMP de Rossini | [quote="Antonio Linares":3hildpdw]Marcelo,
Te enviamos por email la clase de FWH, modificada compatible con la de Rossine para que la pruebes. Gracias.[/quote:3hildpdw]
Gracia Antonio,
cambie el prg respectivo, si bien no tengo problemas con hacer mas de un click para que se ejecute el ACTION, pero ahora ya no se muestran los BMPs del boton <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( -->
saludos
Marcelo |
ButtonBMP de Rossini | Te envio fivewin.ch por email |
ButtonBMP de Rossini | Antonio
Podrías enviarmelas a mí tambien.
Gracias
Toni Sales |
ButtonBMP de Rossini | Toni,
Enviados, |
ButtonBMP de Rossini | [quote="Antonio Linares":1nijd9gr]Te envio fivewin.ch por email[/quote:1nijd9gr]
Recibido Antonio, pero te coimento que el comportamiento sigue igual, otra idea?
saludos
Marcelo |
ButtonBMP de Rossini | Prueba este ejemplo. Aqui funciona correctamente:
<!-- m --><a class="postlink" href="http://hyperupload.com/download/0200ce8d51/testbubm.zip.html">http://hyperupload.com/download/0200ce8 ... m.zip.html</a><!-- m --> |
ButtonBMP de Rossini | [quote="Antonio Linares":28h5c0hk]Prueba este ejemplo. Aqui funciona correctamente:
<!-- m --><a class="postlink" href="http://hyperupload.com/download/0200ce8d51/testbubm.zip.html">http://hyperupload.com/download/0200ce8 ... m.zip.html</a><!-- m -->[/quote:28h5c0hk]
Antonio,
gracias, solucionado, reemplace el fivewin.ch y quite el buttonbmp.ch, este ultimo era el problema, ahora todo esta Ok, perdon por tu tiempo
saludos
Marcelo |
ButtonBMP de Rossini | Antonio, podrías enviarme la clase a mí también por favor, y de ser posible el ejemplo, que de hecho ya no está disponible en el Hiperupload?
Gracias desde ya |
ButtonBMP de Rossini | Jose,
Enviada por email, |
ButtonBMP de Rossini | Antonio
me la podria enviar tambien a mi por favor.
Saludos
Marco A. Delgado. |
ButtonBMP de Rossini | Marco,
Vamos a publicarla dentro de pocos días en el build de Abril. |
ButtonBMP de Rossini | Olá Antonio,
Grande notícia <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> Toda comunidade será beneficiada com isto. Você pretende implementar as mudanças que eu fiz sobre a classe TFolder também ?
Eu realmente prefiro as próprias classe do fivewin do que as classes de terceiro, pois assim temos certeza da continuidade e evolução das mesmas.
Saludos,
Rossine. |
ButtonBMP de Rossini | Rossine,
Si, también publicaremos los cambios de TFolder. En la clase TButtonBmp hemos cambiado algunas cosas.
Gracias! |
ButtonBMP de Rossini | OK Maestro <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Gracias, Saludos.
Rossine. |
ButtonBMP de Rossini | Rossini podrias enviarme la clase a mi tambien por favor.
saludos.
fernando sandoval ruiz |
ButtonBMP de Rossini | [quote="Antonio Linares":2ongwc5s]Marco,
Vamos a publicarla dentro de pocos días en el build de Abril.[/quote:2ongwc5s]
Entonio,
me prodrias enviar ese fuente a mi coreo por favor
saludos cordiales <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
ButtonBMP de Rossini | me uno a la peticion |
ButtonBMP de Rossini | Hola compañeros del foro
tengo problemas ya que tambien tengo que pulsar varias veces el el boton para que me responda
ojala y me puedan ayudar
saludos cordiales
jose Luis |
ButtonBar | Hola a todos:
Estoy implementando mis programas con las buttonbar, y me pasa lo siguiente:
Cuando pasa del menú principal a un menú de opciones, no puedo conseguir que se mantenga la letra inicial. Esta es la barra de menú de menú Principal:
[img:250e3suh]http://www.colthop.es/imagen01.jpg[/img:250e3suh]
Y cuando entramos en una opción quito la BUTTONBAR con: "oVentPrinc:oBar:End()" y pongo la otra barra en la siguiente ventana y queda así:
[img:250e3suh]http://www.colthop.es/imagen03.jpg[/img:250e3suh]
En vez de quedar como desearía y es:
[img:250e3suh]http://www.colthop.es/imagen02.jpg[/img:250e3suh]
Esto lo consigo gracias a que en vez de eliminar la BUTTONBAR la oculto con oBar:Hide(). Me gustaría saber si se sigue entrando en opciones se sigan creando nuevas BUTTONBAR estas usan cada vez mas memoria y objetos o cuando la ocultas y creas otra la anterior se elimina.
Un saludo
Carlos |
ButtonBar | Se me olvidaba:
He intentado quitar un botón de la ButtonBar con oBtn:End() y pese a que no funciona a partir de la instrucción no se quita la imagen de la pantalla y aparece como en segundo plano. Me podríais indicar coso se puede quitar.
Un saludo y gracias.
Carlos |
ButtonBar | [quote="colthop":o09daoay]Se me olvidaba:
He intentado quitar un botón de la ButtonBar con oBtn:End() y pese a que no funciona a partir de la instrucción no se quita la imagen de la pantalla y aparece como en segundo plano. Me podríais indicar coso se puede quitar.
Un saludo y gracias.
Carlos[/quote:o09daoay]
Prueba a utilizar el Metodo: oBar:Del( nPos ) |
ButtonBar | Hola Cristóbal:
Ante todo gracias por tu interés y en un principio parece que funciona pero pasa una cosa extraña después y es lo siguiente cuando tengo siete botones y quito por ejemplo el 3 todos se mueven uno a la izquierda pero cuando paso el ratón por el tercero (que antes era el cuarto) vuelve a mostrar el botón que he quitado y esto solo pasa con la posición que he quitado el resto si quedan bien.
Un saludo
Carlos |
ButtonBar | Carlos,
Puedes proporcionar un ejemplo para probarlo aqui ? gracias |
ButtonBar | Hola Antonio:
Me es muy difícil en este momento ya que como no sabia como solucionarlo quite las dos BUTTONBAR y sus botones y lo estoy sustituyendo por RIBBONBAR.
Pero era muy sencillo de recrear era en una ventana inical con un menú y se creaba la BUTTONBAR
Pongamos:
[code=fw:2hy4b68v]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oVentPrinc <span style="color: #0000ff;">MDI</span> <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">24</span>,<span style="color: #000000;">80</span>;<br /> COLORS escri1, RGB <span style="color: #000000;">(</span><span style="color: #000000;">100</span>, <span style="color: #000000;">10</span>, <span style="color: #000000;">10</span><span style="color: #000000;">)</span>;<br /> <span style="color: #0000ff;">ICON</span> <span style="color: #ff0000;">"FyVWin.ico"</span><br /> SET <span style="color: #0000ff;">FONT</span> <span style="color: #0000ff;">OF</span> oVentPrinc <span style="color: #0000ff;">TO</span> oFont<br /> SET <span style="color: #0000ff;">MESSAGE</span> <span style="color: #0000ff;">OF</span> oVentPrinc <span style="color: #0000ff;">TO</span> LocaText<span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span>,<span style="color: #000000;">837</span><span style="color: #000000;">)</span> KEYBOARD CLOCK DATE <span style="color: #000000;">2007</span><br /> oVentPrinc:<span style="color: #000000;">oMenu</span>:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oVentPrinc <span style="color: #0000ff;">MAXIMIZED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> pintboto<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">VALID</span> ! GetKeyState <span style="color: #000000;">(</span>VK_ESCAPE<span style="color: #000000;">)</span></div>[/code:2hy4b68v]
En un principio quito el menú y ejecuto "PintBoto" para colocar las cosas en un orden y no este saltando en la pantalla las cosas
[code=fw:2hy4b68v]<div class="fw" id="{CB}" style="font-family: monospace;">PROCEDURE pintboto<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oVentPrinc:<span style="color: #000000;">SetMenu</span><span style="color: #000000;">(</span>MenuPrin<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">if</span> ! empty <span style="color: #000000;">(</span>oBar<span style="color: #000000;">)</span><br /> oVentPrinc:<span style="color: #000000;">oBar</span>:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">if</span> ! empty <span style="color: #000000;">(</span>oDlgwDat<span style="color: #000000;">)</span><br /> oDlgwDat:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">endif</span><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oVentPrinc <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">80</span>,<span style="color: #000000;">80</span> <span style="color: #000000;">2010</span><br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> ...<br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> ...<br /><br />pintabaj<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oBar:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">)</span></div>[/code:2hy4b68v]
Todas las opciones del Menu llaman una función con dos variables Menu y Submenú para ejecuar lo deseado y antes poder poner la pantalla como quiero
[code=fw:2hy4b68v]<div class="fw" id="{CB}" style="font-family: monospace;">Procedure OpciMenu<span style="color: #000000;">(</span>men,sumen,xOpc<span style="color: #000000;">)</span><br /><span style="color: #0000ff;">menu</span> = men<br />submenu = sumen<br />oDlgwDat:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />aquí va una de estas dos lineas<br />oBar:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oVentPrinc:<span style="color: #000000;">oBar</span>:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br />oVentPrinc:<span style="color: #000000;">oMenu</span>:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oVentPrinc:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oVentPrinc:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">if</span> xOpc = <span style="color: #000000;">1</span><br /> oBar:<span style="color: #000000;">nheight</span>:=<span style="color: #000000;">20</span><br /> DatoSele<span style="color: #000000;">(</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">else</span><br /> oBar:<span style="color: #000000;">nheight</span>:=<span style="color: #000000;">50</span><br /><span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br /> <span style="color: #00C800;">case</span> <span style="color: #0000ff;">menu</span> = <span style="color: #000000;">1</span><br /> gestempr<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />...<br /> </div>[/code:2hy4b68v]
Y una vez entrado en GestEmpr creaba una MDICHILD para su gestión y otra BUTTONBAR de la ventana principal y es aquí cuando se ponía la letra mal o no. Incluso después cuando volvia a la pantalla principal estaba mal la letra.
Mas o menos es así espero que sirva.
Un saludo
Carlos |
ButtonBar | Hello friends.
In ButtonBar is it possible to align all buttons from right to left?
Thank you |
ButtonBar | BtNRIGHT comand |
ButtonBar | In case BTNRIGHT puts only the last button on the right, is it correct? |
ButtonBar | YES
SAMPLE
DEFINE BUTTONBAR obar _3D SIZE 100, 32 OF oAllegati 2015 GDIPLUS BOTTOM NOBORDER
DEFINE BUTTON oScansiona OF obar ;
RESOURCE "SCANNER" ;
PROMPT "Scansiona" ;
LEFT BTNRIGHT;
ACTION MSGINFO()
OR
insert where you want but then you must insert also a resize function
oScansiona:= TBtnBmp():NewBar("Scansiona",,,,,, .F., obar, .F.,,, .F.,,,,,,,,,,,,, .F.,,, )
oScansiona:nLeft:= obar:nWidth-120 |
ButtonBar / Toolbar + Combobox ? | hi,
is it possible to add Combobox into ButtonBar / Toolbar under Fivewin <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
if yes how <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
[img:2sfo4x7f]https://i.postimg.cc/wTJ3sh4J/Toolbar-Controls.jpg[/img:2sfo4x7f] |
ButtonBar / Toolbar + Combobox ? | Buttonbar is FWH's own control and we can, for sure, have other controls like combobox within buttonbar. |
ButtonBar / Toolbar + Combobox ? | Mr. Rao
Is it possible to also add a GET control to BUTTONBAR ?
Can you give an example please. |
ButtonBar / Toolbar + Combobox ? | [quote="albeiroval":26e9n6hh]Mr. Rao
Is it possible to also add a GET control to BUTTONBAR ?
Can you give an example please.[/quote:26e9n6hh]
Sample:
[code=fw:26e9n6hh]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oWnd, oBar, oGet, oCbx<br /> <span style="color: #00C800;">local</span> nVar := <span style="color: #000000;">900</span><br /> <span style="color: #00C800;">local</span> cVar := <span style="color: #ff0000;">"Three"</span><br /><br /> SetGetColorFocus<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">70</span>,<span style="color: #000000;">40</span> <span style="color: #000000;">2010</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"One"</span> <span style="color: #0000ff;">CENTER</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Two"</span> <span style="color: #0000ff;">CENTER</span><br /><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">160</span> <span style="color: #0000ff;">GET</span> oGet <span style="color: #0000ff;">VAR</span> nVar <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"999"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">RIGHT</span> <span style="color: #0000ff;">OF</span> oBar ;<br /> <span style="color: #0000ff;">VALID</span> <span style="color: #000000;">(</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> nVar <span style="color: #000000;">)</span>, .t. <span style="color: #000000;">)</span><br /> @ <span style="color: #000000;">10</span>,<span style="color: #000000;">240</span> <span style="color: #0000ff;">COMBOBOX</span> oCbx <span style="color: #0000ff;">VAR</span> cVar <span style="color: #0000ff;">ITEMS</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"One"</span>,<span style="color: #ff0000;">"Two"</span>,<span style="color: #ff0000;">"Three"</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">90</span>,<span style="color: #000000;">200</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oBar<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Exit"</span> <span style="color: #0000ff;">CENTER</span> GROUP BTNRIGHT ;<br /> <span style="color: #0000ff;">ACTION</span> oWnd:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oWnd:<span style="color: #000000;">nWidth</span> := <span style="color: #000000;">700</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">CENTERED</span><br /><br /> ? nVar, cVar<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:26e9n6hh] |
ButtonBar / Toolbar + Combobox ? | GREAT
thx for Sample |
ButtonBar / Toolbar + Combobox ? | Fine, thanks |
ButtonBar / Toolbar + Combobox ? | hi,
i have a Problem when place "only" 1 x GET into ButtonBar
as it can not "change" to other Control it does not "lostFocus" -> no VALID -> no GOTO <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
any Idea for a Workaround <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
ButtonBar / Toolbar + Combobox ? | Example?
Regards. |
ButtonBar / Toolbar + Combobox ? | [quote="Jimmy":3r517zot]hi,
i have a Problem when place "only" 1 x GET into ButtonBar
as it can not "change" to other Control it does not "lostFocus" -> no VALID -> no GOTO <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
any Idea for a Workaround <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->[/quote:3r517zot]
Yes.
We need to have atleast 2 controls. |
ButtonBar / Toolbar + Combobox ? | hi,
[quote="nageswaragunupudi":27l02pa4]We need to have atleast 2 controls.[/quote:27l02pa4]
thx for Answer
i will include a 2nd Control |
ButtonBar / Toolbar + Combobox ? | In fact, it is the same situation when we have only one Get control on a dialog/window. |
ButtonBar 2007 - lPressed look | On Buttonbars without 2007 look the buttons appear differently with lPressed := .t. or .f.. I was using this functionality.
But with 2007 style, there is no difference in the appearance whether lPessed := .t. or .f.
As a workaround, for the time being, i am using two bitmaps, but the Pressed look is more meaningful and clear to the user. Wish this can be provided |
ButtonBar 2007 - lPressed look | Just to serve as remainder in case this post unfortunately missed Mr. Antonio's attention please. |
ButtonBar 2007 - lPressed look | NageswaraRao,
Its on our todo list. Thanks, |
ButtonBar 3D | The new button bars with 2007 look great. For a while going back to the old 3d style button bars I noticed a small problem.
If we normally define a button bar as "DEFINE BUTTONBAR oBar OF oWnd SIZE 60,60 3D", it is working. But if we try the following code :
[code:204fwugz]
DEFINE BUTTONBAR oBar OF oWnd SIZE 60,60
oBar:l3D := .T.
[/code:204fwugz]
I am getting this kind of appearance.
[url=http://imageshack.us:204fwugz][img:204fwugz]http://img87.imageshack.us/img87/5752/bar3diw7.png[/img:204fwugz][/url:204fwugz]
I noticed this when I was writing code for conditional use of 2007 style depending on the ColorsQty(). Though right now, I am getting what I want by coding in a different way, I feel that the button bars should paint correctly even for the above code |
ButtonBar 3D | You can not set that property later on. It has to be specified when you create the buttonbar:
oBar:l3D := .T.
If you want to use it or not, use two different sentences:
if lWant3D
DEFINE BUTTONBAR ... 3D
else
DEFINE BUTTONBAR ...
endif |
ButtonBar Non-2007 style Bitmap and Text Alignment | When button-bar is used without 2007 style, the bitmaps and prompts are getting mixed up.
Sample Source Code:
[code=fw:16fsrwio]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">'fivewin.ch'</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> ownd, oBar<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">64</span>,<span style="color: #000000;">64</span> <span style="color: #B900B9;">//2007</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel1.bmp'</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">'Level1'</span> TOP<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel2.bmp'</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">'Level2'</span> TOP<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel3.bmp'</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">'Level3'</span> TOP<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel4.bmp'</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">'Level4'</span> TOP<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:16fsrwio]
Result
[url=http://img696.imageshack.us/my.php?image=bbar.jpg:16fsrwio][img:16fsrwio]http://img696.imageshack.us/img696/5075/bbar.jpg[/img:16fsrwio][/url:16fsrwio]
Is there anything I am missing? Or is there a problem to be fixed in BtnBmp.Prg ? |
ButtonBar Non-2007 style Bitmap and Text Alignment | Dear MR.Rao,
Here is a trick. I am sure that this is not a good solution, it is only a work around. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
[url=http://img704.imageshack.us/i/raom.jpg/:ttcwu1c9][img:ttcwu1c9]http://img704.imageshack.us/img704/8773/raom.jpg[/img:ttcwu1c9][/url:ttcwu1c9]
[code=fw:ttcwu1c9]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">'fivewin.ch'</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> ownd, oBar<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">64</span>,<span style="color: #000000;">64</span> <span style="color: #B900B9;">//2007</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel1.bmp'</span> <span style="color: #0000ff;">PROMPT</span> CRLF+<span style="color: #ff0000;">'Level1'</span> TOP<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel2.bmp'</span> <span style="color: #0000ff;">PROMPT</span> CRLF+<span style="color: #ff0000;">'Level2'</span> TOP<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel3.bmp'</span> <span style="color: #0000ff;">PROMPT</span> CRLF+<span style="color: #ff0000;">'Level3'</span> TOP<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar FILE <span style="color: #ff0000;">'<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\l</span>evel4.bmp'</span> <span style="color: #0000ff;">PROMPT</span> CRLF+<span style="color: #ff0000;">'Level4'</span> TOP<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:ttcwu1c9]
Regards
Anser |
ButtonBar Non-2007 style Bitmap and Text Alignment | <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->)
This was not the intention |
ButtonBar Translucent | Really nice <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
ButtonBar Translucent | [url=https://imageshack.com/i/plE0gbaep:1i6vh3lu][img:1i6vh3lu]http://imagizer.imageshack.us/v2/xq90/921/E0gbae.png[/img:1i6vh3lu][/url:1i6vh3lu] |
ButtonBar Translucent | Show!!!!!! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
ButtonBar Translucent | Awesome ! |
ButtonBar Translucent | how create it ?
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=32448">viewtopic.php?f=3&t=32448</a><!-- l --> |
ButtonBar Translucent | fwh\samples\bartrnsl.prg
In addition to the screnshot, the sample also has a transparency bar on msgbar to vary the degree of transparency.
You may also try \fwh\samples\btntrns.prg
This shows creation of translucent buttons (btnbmp) |
ButtonBar Translucent | thanks |
ButtonBar and buttons | I wish Know if is possible make a modify on buttonbar .
I explain you
I wish have the possibilty to move some buttons at the right angle as this :
[img:2gs42ij4]https://s13.postimg.org/6cvwfu9h3/image.png[/img:2gs42ij4]
this picture is made with a oldest class ( not of fwh) now run bad.
I tried with :
oHelp:= TBtnBmp():NewBar(,, "help.bmp",,,, .F., obar, .F.,,, .F.,,,,,,,,,,,,, .F.,,, )
oHelp:nWidth:=30
oHelp:nLeft:= obar:nWidth-100
But I can fix the position and when I move the dialog it is allway on the same position |
ButtonBar and buttons | Use clause BTNRIGHT
[quote:2y70z40j]
DEFINE BUTTON OF oBarMdi PROMPT "Exit" ;
FILE "D:\Fwh\FwhTeam\BmpsVS_32\MappedTracepointDisable_32x_24.bmp" ;
ACTION ( oWnd:End() ) [b:2y70z40j]BTNRIGHT[/b:2y70z40j] ;
GROUP LABEL "Salir" COLORS CLR_WHITE, METRO_OLIVE
[/quote:2y70z40j] |
ButtonBar and buttons | thanks run good
I made
[code=fw:1ilb9yoy]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> obar ;<br /> filename <span style="color: #ff0000;">"help.bmp"</span> ;<br /> <span style="color: #0000ff;">LEFT</span> BTNRIGHT;<br /> GROUP ;<br /> <span style="color: #0000ff;">action</span> oAllegati:<span style="color: #000000;">end</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> obar ;<br /> filename <span style="color: #ff0000;">"Chiudi.bmp"</span> ;<br /> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Chiudi"</span> ;<br /> <span style="color: #0000ff;">LEFT</span> ;<br /> GROUP ;<br /> <span style="color: #0000ff;">action</span> oAllegati:<span style="color: #000000;">end</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></div>[/code:1ilb9yoy]
and this is the result
[img:1ilb9yoy]https://s13.postimg.org/chs07d93b/bmio.png[/img:1ilb9yoy]
the button help is too large also if not have the prompt
the button chiudi is not at the end of dialog
any solution ? |
ButtonBar button with odragcursor problems | If a button in the buttonbar is also used to start drag operation by assigning a value to its data oDragCursor it is noticed that (1) the buttons bAction block is never executed, (2) mouse click on the button has no effect, (3) in case of 2007 style, when mouse is moved over the button, it is painted in orange color but even after mouse leaves the button the orange color stays till the end of the application (4) in case of non-2007 style the button is never hilighted when mouse is moved over the button. Only drag works.
A sample code is given below for testing all the alternatives. For bitmaps any available bmp files may be used.
[code:8jf739xv]
#include 'fivewin.ch'
function Main()
local ownd,oBar
local oBtn1, oBtn2, oBtn3, oBtn4, oBtn5
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd SIZE 64,64 3D // 2007
DEFINE BUTTON oBtn1 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "1" FLAT ACTION oWnd:Say( 10, 5, "Btn.1" )
DEFINE BUTTON oBtn2 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "2" FLAT ACTION oWnd:Say( 10, 5, "Btn.2" )
DEFINE BUTTON oBtn3 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "3" FLAT ACTION oWnd:Say( 10, 5, "Btn.3" )
DEFINE BUTTON oBtn4 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "4" FLAT ACTION oWnd:Say( 10, 5, "Btn.4" )
DEFINE BUTTON oBtn5 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "Q" FLAT ACTION oWnd:End()
oBtn3:oDragCursor := TCursor():New(,'DRAG')
oBtn3:bDragBegin := { |r,c,f| nil }
oWnd:bDropOver := { |u,r,c,f| MsgInfo("Dropped") }
ACTIVATE WINDOW oWnd
return nil
[/code:8jf739xv]
Issues need to be fixed:
1. In 2007 style, the button should be painted active ( orange color ) only when mouse is over the button and the color to be restored to normal when mouse moves away from the button.
2. Non 2007 style: Button should be highlighted ( like other buttons ) when mouse is moved over the button.
3. When mouse is clicked on the button, (a) second bitmap should be painted (b) button should be painted as clicked like other buttons (c) bAction should be executed if drag does not start. |
ButtonBar display problems | Using a button bar, defined as:
REDEFINE BUTTONBAR oBarCL ID 101 SIZE 60,60 OF oFldCSE:aDialogs[1] 2015
oBarCL:bClrGrad := aPubGrad
And a resource:
CONTROL "", 101, "TBar", 0|WS_CHILD|WS_VISIBLE, 0,0, 645, 30
In a dialog, 650 wide
There are two problems:
1) The bar does not extend past the last button. In the past, and in a window, it covers the full width of the screen.
2) The background is a gradient. All buttons are Alpha Bitmaps. However, some buttons do not have the gradient background. It is missing. It might be one button, or 2 to 3 buttons in a row.
This behavior is happening on all BUTTONBAR controls used in dialogs.
Help ? |
ButtonBar display problems | Tim, modify with your gradient in this sample, try and post it
Sample:
[code=fw:2nnbwecw]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBar, oFont, oBrw<br /><br /> USE STATES<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"timbar"</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"FWH 16.05 BUTTONBAR FROM RESOURCE"</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">ID</span> <span style="color: #000000;">100</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #000000;">2015</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Add"</span> GROUP FILE <span style="color: #ff0000;">"..<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\A</span>lphaBmp<span style="color: #000000;">\d</span>own.bmp"</span> <span style="color: #B900B9;">//32x32\new.bmp"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Edit"</span> GROUP FILE <span style="color: #ff0000;">"..<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\A</span>lphaBmp<span style="color: #000000;">\G</span>Mail.bmp"</span> <span style="color: #B900B9;">//32x32\edit.bmp"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Delete"</span> GROUP FILE <span style="color: #ff0000;">"..<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\A</span>lphaBmp<span style="color: #000000;">\G</span>raphics.bmp"</span> <span style="color: #B900B9;">//delete.bmp"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Print"</span> GROUP FILE <span style="color: #ff0000;">"..<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\A</span>lphaBmp<span style="color: #000000;">\f</span>loppy.bmp"</span> <span style="color: #B900B9;">//print32.bmp" </span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Quit"</span> GROUP FILE <span style="color: #ff0000;">"..<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\A</span>lphaBmp<span style="color: #000000;">\q</span>uestion.bmp"</span> <span style="color: #0000ff;">ACTION</span> oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//32x32\exit.bmp" </span><br /><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">ID</span> <span style="color: #000000;">101</span> <span style="color: #0000ff;">OF</span> oDlg DATASOURCE <span style="color: #0000ff;">Alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">AUTOCOLS</span> FOOTERS<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /> </div>[/code:2nnbwecw]
[code=fw:2nnbwecw]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <windows.h><br /><br />timbar <span style="color: #0000ff;">DIALOG</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">400</span>, <span style="color: #000000;">200</span><br /><span style="color: #0000ff;">STYLE</span> DS_MODALFRAME | WS_BORDER | WS_DLGFRAME | WS_POPUP | WS_SYSMENU<br /><span style="color: #0000ff;">FONT</span> <span style="color: #000000;">8</span>, <span style="color: #ff0000;">"MS Sans Serif"</span><br />CAPTION <span style="color: #ff0000;">"Test"</span><br />BEGIN<br /> CONTROL <span style="color: #ff0000;">""</span>, <span style="color: #000000;">100</span>, <span style="color: #ff0000;">"TBar"</span>, <span style="color: #000000;">0</span> | WS_CHILD | WS_VISIBLE, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">480</span>, <span style="color: #000000;">40</span><br /> DEFPUSHBUTTON <span style="color: #ff0000;">"OK"</span>, IDOK, <span style="color: #000000;">40</span>, <span style="color: #000000;">168</span>, <span style="color: #000000;">50</span>, <span style="color: #000000;">14</span>, WS_VISIBLE<br /> PUSHBUTTON <span style="color: #ff0000;">"Cancel"</span>, IDCANCEL, <span style="color: #000000;">101</span>, <span style="color: #000000;">168</span>, <span style="color: #000000;">50</span>, <span style="color: #000000;">14</span>, WS_VISIBLE<br /> CONTROL <span style="color: #ff0000;">""</span>, <span style="color: #000000;">101</span>, <span style="color: #ff0000;">"TXBrowse"</span>, <span style="color: #000000;">0</span> | WS_CHILD | WS_VISIBLE | WS_TABSTOP, <span style="color: #000000;">10</span>, <span style="color: #000000;">50</span>, <span style="color: #000000;">360</span>, <span style="color: #000000;">100</span><br />END<br /> </div>[/code:2nnbwecw] |
ButtonBar display problems | Here is the gradient.
PUBLIC aPubGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
{ 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
Please note my bitmaps are in the .rc file so it's not "the same"
Also, in your example, your dialog is 400 wide and your bar is 480 wide.
The bar now has this behavior in every single dialog where one is used. There are NO exceptions. The gradient only applies to ( most ) buttons but not all, and the bar only extends to the end of the last button. |
ButtonBar display problems | Ok, I understand the differences
I'll try with your instructions |
ButtonBar display problems | Tim,
I added a buttonbar to my new sample
instead of a RC-file for images I used a DLL
I cannot see any wrong paintings
All selected buttons are painted transparent.
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/DOWNLOADS/Dlltest1.zip">http://www.pflegeplus.com/DOWNLOADS/Dlltest1.zip</a><!-- m -->
( still the part from RC / DLL is under construction )
[quote:279amk0k]1) The bar does not extend past the last button.
In the past, and in a window, it covers the full width of the screen.
2) The background is a gradient. All buttons are Alpha Bitmaps.
However, some buttons do not have the gradient background.
It is missing. It might be one button, or 2 to 3 buttons in a row.[/quote:279amk0k]
[img:279amk0k]http://www.pflegeplus.com/IMAGES/Btnbar3.jpg[/img:279amk0k]
[color=#0000FF:279amk0k]...
...
aPubGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
{ 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }
from CODE
DEFINE DIALOG oDlg1 TITLE "Test folder from CODE" SIZE 650, 550 PIXEL OF oWnd BRUSH oBrush0
DEFINE BUTTONBAR oBar SIZE 60, 30 OF oDlg1 2015
oBar:bClrGrad := aPubGrad
DEFINE BUTTON OF oBar PROMPT "Paint" GROUP RESOURCE "COLORS" FONT oFont1 // bitmaps from DLL
DEFINE BUTTON OF oBar PROMPT "Edit" GROUP RESOURCE "CODE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "View" GROUP RESOURCE "FONTS" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Create" GROUP RESOURCE "RESOURCE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Quit" GROUP RESOURCE "EXIT" ACTION oDlg1:End() FONT oFont1
...
...[/color:279amk0k]
[color=#008000:279amk0k]from RESOURCE
SetResources( hSave ) // RC-file
DEFINE DIALOG oDlg2 RESOURCE "DPainter" BRUSH oBrush0 PIXEL ;
FONT oFont1 TITLE "Test folder from RESOURCES" OF oWnd
REDEFINE BUTTONBAR oBar ID 100 OF oDlg2 2015
oBar:bClrGrad := aPubGrad
...
...
SET RESOURCES TO c_path + "SYSTEM.dll" // select from DLL
DEFINE BUTTON OF oBar PROMPT "Paint" GROUP RESOURCE "COLORS" FONT oFont1 // bitmaps from DLL
DEFINE BUTTON OF oBar PROMPT "Edit" GROUP RESOURCE "CODE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "View" GROUP RESOURCE "FONTS" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Create" GROUP RESOURCE "RESOURCE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Quit" GROUP RESOURCE "EXIT" ACTION oDlg1:End() FONT oFont1
...
...
SetResources( hSave ) // access from rc[/color:279amk0k]
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
ButtonBar display problems | Actual code:
[code=fw:zquygtkb]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> list01<br /> <span style="color: #B900B9;">// Labor rates list01</span><br /> <span style="color: #B900B9;">// Updated: 7/28/2015 2:59:33 PM</span><br /> <br /> <span style="color: #00C800;">LOCAL</span> oBarLst<br /> <span style="color: #00C800;">PRIVATE</span> oDepartment, oEdit, lFirst := .F.<br /> <span style="color: #B900B9;">// Open the labor rate reference database and index</span><br /> oLaborRate := tLaborRate<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">IF</span> oLaborRate:<span style="color: #000000;">reccount</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span> = <span style="color: #000000;">0</span><br /> MsgAlert<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Adding a first record"</span><span style="color: #000000;">)</span><br /> oLaborRate:<span style="color: #000000;">append</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> oLaborRate:<span style="color: #000000;">save</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span><br /> lFirst := .T.<br /> <span style="color: #00C800;">ENDIF</span><br /> oLaborRate:<span style="color: #000000;">gotop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oLaborRateR := TRecord<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span> oLaborRate <span style="color: #000000;">)</span><br /> oLaborRateR:<span style="color: #000000;">load</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// Open the dialog using a resource from EMS.DLL</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"LISTS"</span> <span style="color: #0000ff;">BRUSH</span> oBrush transparent <span style="color: #0000ff;">OF</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Labor Rates"</span> <br /> oDlg:<span style="color: #000000;">nHelpID</span> := <span style="color: #000000;">5</span><br /> <span style="color: #B900B9;">// Build the edit controls</span><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">SAY</span> oSa1 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Charge"</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">4900</span> <span style="color: #0000ff;">OF</span> oDlg<br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oEdit <span style="color: #0000ff;">VAR</span> oLaborRateR:<span style="color: #000000;">charge</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">102</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">PICTURE</span> <span style="color: #ff0000;">"$99999.99"</span> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"The charge for this service"</span> <span style="color: #0000ff;">UPDATE</span><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">SAY</span> oSa2 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Service"</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">4901</span> <span style="color: #0000ff;">OF</span> oDlg<br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> oLaborRateR:<span style="color: #000000;">servic</span> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">103</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"A description of the service type"</span> <span style="color: #0000ff;">UPDATE</span><br /><br /> <span style="color: #B900B9;">// Create the BROWSE control</span><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">XBROWSE</span> oLbx1 ;<br /> DATASOURCE oLaborRate ;<br /> HEADERS <span style="color: #ff0000;">" Charge "</span>, <span style="color: #ff0000;">" Service "</span>, <span style="color: #ff0000;">" "</span> ;<br /> COLUMNS <span style="color: #ff0000;">"charge"</span>, <span style="color: #ff0000;">"servic"</span>, <span style="color: #ff0000;">" "</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">101</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">CHANGE</span> <span style="color: #000000;">(</span> oLaborRateR:<span style="color: #000000;">load</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oDlg:<span style="color: #0000ff;">update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">UPDATE</span> <br /><br /> <span style="color: #B900B9;">// Provide the header gradient</span><br /> oLbx1:<span style="color: #000000;">bClrGrad</span> := aPubGrad <br /> <span style="color: #B900B9;">// Set the styles</span><br /> oLbx1:<span style="color: #000000;">nMarqueeStyle</span> := MARQSTYLE_HIGHLROW<br /> oLbx1:<span style="color: #000000;">nColDividerStyle</span> := LINESTYLE_RAISED<br /> oLbx1:<span style="color: #000000;">nRowDividerStyle</span> := LINESTYLE_RAISED<br /> oLbx1:<span style="color: #000000;">nHeadStrAligns</span> := AL_CENTER<br /> oLbx1:<span style="color: #000000;">nStretchCol</span> := STRETCHCOL_LAST<br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBarLst <span style="color: #0000ff;">ID</span> <span style="color: #000000;">105</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">60</span>,<span style="color: #000000;">60</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #000000;">2015</span><br /> oBarLst:<span style="color: #000000;">bClrGrad</span> := aPubGrad<br /> <br /> <span style="color: #B900B9;">// Build the button controls</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBarLst <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"HRADD"</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Add"</span> TOOLTIP <span style="color: #ff0000;">"Add a record"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oLbx1:<span style="color: #000000;">gobottom</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oLaborRate:<span style="color: #000000;">append</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span>, oLaborRate:<span style="color: #000000;">blank</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span>, oLbx1:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oLaborRateR:<span style="color: #000000;">load</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oDlg:<span style="color: #0000ff;">update</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span>,;<br /> oEdit:<span style="color: #000000;">setfocus</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Add a new item"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBarLst <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"HRSAVE"</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Save"</span> TOOLTIP <span style="color: #ff0000;">"Save changes"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> oLaborRateR:<span style="color: #000000;">save</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span>, oDlg:<span style="color: #0000ff;">update</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span>, oLbx1:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oLbx1:<span style="color: #000000;">setfocus</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Save any changes made to the current item"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBarLst <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"HRDELETE"</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Delete"</span> TOOLTIP <span style="color: #ff0000;">"Delete selected record"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> IIF<span style="color: #000000;">(</span> MsgYesNo<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Do you wish to delete this item ?"</span><span style="color: #000000;">)</span>, <span style="color: #000000;">(</span> oLaborRate:<span style="color: #000000;">delete</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span>,;<br /> oLaborRate:<span style="color: #000000;">skip</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span>, oLbx1:<span style="color: #0000ff;">refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oLaborRateR:<span style="color: #000000;">load</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, oDlg:<span style="color: #0000ff;">update</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>,<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Delete the current item"</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBarLst <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"HRHELP"</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Help"</span> TOOLTIP <span style="color: #ff0000;">"Open OnLine Manual"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> WinExec<span style="color: #000000;">(</span> <span style="color: #ff0000;">"hh asw9.chm"</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBarLst <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"HREXIT"</span> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Exit"</span> TOOLTIP <span style="color: #ff0000;">"Exit this list"</span> ;<br /> <span style="color: #0000ff;">ACTION</span> oDlg:<span style="color: #000000;">end</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">MESSAGE</span> <span style="color: #ff0000;">"Exit this list"</span><br /><br /> <span style="color: #B900B9;">// Activate the dialog screen</span><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> oReBar:<span style="color: #000000;">hide</span><span style="color: #000000;">(</span> <span style="color: #000000;">)</span> <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #B900B9;">// Redisplay the bar</span><br /> oReBar:<span style="color: #000000;">show</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// Close the file</span><br /> oLaborRate:<span style="color: #000000;">close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /> </div>[/code:zquygtkb]
.RC code, assembled into the .exe
[code=fw:zquygtkb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />LISTS <span style="color: #0000ff;">DIALOG</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">660</span>, <span style="color: #000000;">410</span><br /><span style="color: #0000ff;">STYLE</span> WS_POPUP | WS_CAPTION<br />CAPTION <span style="color: #ff0000;">"List Editor"</span><br /><span style="color: #000000;">{</span><br /> CONTROL <span style="color: #ff0000;">""</span>, <span style="color: #000000;">105</span>, <span style="color: #ff0000;">"TBar"</span>, <span style="color: #000000;">0</span>|WS_CHILD|WS_VISIBLE, <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span>, <span style="color: #000000;">660</span>, <span style="color: #000000;">30</span><br /> CONTROL <span style="color: #ff0000;">""</span>,<span style="color: #000000;">101</span>,<span style="color: #ff0000;">"TxBrowse"</span>,WS_BORDER | WS_VSCROLL | WS_TABSTOP,<span style="color: #000000;">10</span>,<span style="color: #000000;">80</span>,<span style="color: #000000;">640</span>,<span style="color: #000000;">310</span><br /> EDITTEXT <span style="color: #000000;">102</span>,<span style="color: #000000;">110</span>,<span style="color: #000000;">40</span>,<span style="color: #000000;">200</span>,<span style="color: #000000;">13</span><br /> EDITTEXT <span style="color: #000000;">103</span>,<span style="color: #000000;">110</span>,<span style="color: #000000;">55</span>,<span style="color: #000000;">200</span>,<span style="color: #000000;">13</span><br /> LTEXT <span style="color: #ff0000;">""</span>,<span style="color: #000000;">4900</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">40</span>,<span style="color: #000000;">95</span>,<span style="color: #000000;">13</span><br /> LTEXT <span style="color: #ff0000;">""</span>,<span style="color: #000000;">4901</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">55</span>,<span style="color: #000000;">95</span>,<span style="color: #000000;">13</span><br /><span style="color: #000000;">}</span><br /><br /> </div>[/code:zquygtkb]
The result:
[img:zquygtkb]http://masterlinksoftware.com/images/lists.png[/img:zquygtkb] |
ButtonBar display problems | Here is another case:
1) The same bmps ( all Alpha, 32x32 ) display correctly in other bars and then this one is a total mess. ( No gradients ) Compare this to the picture above using the same icons where the gradient is fine.
2) The behavior is the same using Harbour / MSVC 2015 or using xHarbour ( .com )
3) This is the latest FWH.
[img:27puv08w]http://masterlinksoftware.com/images/BadBar.png[/img:27puv08w] |
ButtonBar display problems | Tim
The problem is the use of transparent clause in the definition of dialogue ( then BUTTONBAR show ok, also transparent )
[quote:1xzi63rr]
DEFINE DIALOG oDlg RESOURCE "LISTS" BRUSH oBrush [b:1xzi63rr]transparent[/b:1xzi63rr] OF oWnd TITLE "Labor Rates"
[/quote:1xzi63rr]
Please try
[code=fw:1xzi63rr]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span> oBar:<span style="color: #000000;">lTransparent</span> := .F. <span style="color: #000000;">)</span><br /> </div>[/code:1xzi63rr] |
ButtonBar display problems | This would be convenient to have the default focus:
ON INIT ( oBar:lTransparent := .F., .T. ) |
ButtonBar display problems | Take a look at the last screen shot I provided.
Adding this change, the bar extends the full width of the dialog, BUT the buttons you see without the gradient background still have no background.
I discovered the problem on those finally. In the past, the bitmap buttons used the TRANSPARENT clause. I left that in place when I converted to putting the button bar inside the dialog. It worked fine until recently. Now it has become a problem. Removing the TRANSPARENT from the button commands fixes the problem. |
ButtonBar in Folders | I like to have two or more buttonbars ( tbar() ) in folders, so that the user can switch button bars by choosing the folder tab.
We can do with rebars and toolbars, but I like to do it with FWH buttonbars and folders.
Can this be done easily ? |
ButtonBar in Folders | NageswaraRao,
Please post a screenshot, thanks |
ButtonBar in Folders | This is a part of the screen shot from rebars.prg. This is done thro rebars and toolbar.
Instead I like to get similar functionality using FWH Buttonbar ( tbar() ) in FWH folders.
[url=http://imageshack.us:3ihavgo3][img:3ihavgo3]http://img227.imageshack.us/img227/3186/btnbarinfolderjx7.png[/img:3ihavgo3][/url:3ihavgo3]
If can be done, this will have simpler functionality as officebar, without all that ornamentation and should be easier for development. |
ButtonBar in Folders | NageswaraRao,
Do you mean that you want to place a buttonbar on each dialog of a folder ?
If yes, then you can do it from the ON INIT clause of the main dialog:
[code:1sk3qbxx]
ACTIVATE DIALOG oDlg ;
ON INIT BuildBars( oFolder )
...
function BuildBars( oFolder )
local oBar
DEFINE BUTTONBAR oBar OF oFolder:aDialogs[ 1 ] 3D
DEFINE BUTTON OF oBar ...
...
return nil
[/code:1sk3qbxx] |
ButtonBar in a specific location ( Solved ) | Please put little sample for tests |
ButtonBar in a specific location ( Solved ) | Friends...
How to create a ButtonBar in a specific location in the Window?
The wiki shows:
@ <nRow>, <nCol> BUTTONBAR [<oBar>];
[SIZE <nWidth>, <nHeight>];
[BUTTONSIZE <nBtnWidth>, <nBtnHeight>];
[3D | 3DLOOK | _3D | _3DLOOK];
[TOP | LEFT | RIGHT | BOTTOM | FLOAT];
[OF | WINDOW | DIALOG <oWnd>];
[CURSOR <oCursor>]
But give the following error in the compilation:
Error E0022 Invalid lvalue: 'Numeric'
Can anyone help?
Thanks! |
ButtonBar in a specific location ( Solved ) | Thanks for responding C. Navarro
I need to place the ButtonBar below the Title:
[code=fw:3hfrdqjy]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWndAGENDA <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">600</span>,<span style="color: #000000;">1041</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"GAM - AGENDA DE CONTATOS"</span> COLORS nRGB<span style="color: #000000;">(</span><span style="color: #000000;">215</span>,<span style="color: #000000;">243</span>,<span style="color: #000000;">366</span><span style="color: #000000;">)</span>,nRGB<span style="color: #000000;">(</span><span style="color: #000000;">215</span>,<span style="color: #000000;">215</span>,<span style="color: #000000;">215</span><span style="color: #000000;">)</span> NO MAXIMIZE<br /> <br /> @ <span style="color: #000000;">0000</span>,<span style="color: #000000;">0000</span> <span style="color: #0000ff;">TITLE</span> oTitle <span style="color: #0000ff;">OF</span> oWndAGENDA <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">1025</span>,<span style="color: #000000;">0059</span> NOBORDER <span style="color: #0000ff;">PIXEL</span><br /> oTitle:<span style="color: #000000;">aGrdBack</span> := <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #000000;">1</span>,nRGB<span style="color: #000000;">(</span><span style="color: #000000;">150</span>,<span style="color: #000000;">150</span>,<span style="color: #000000;">150</span><span style="color: #000000;">)</span>,nRGB<span style="color: #000000;">(</span><span style="color: #000000;">150</span>,<span style="color: #000000;">150</span>,<span style="color: #000000;">150</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> oTitle:<span style="color: #000000;">nShadow</span> := <span style="color: #000000;">0</span><br /> <br /> @ <span style="color: #000000;">0010</span>,<span style="color: #000000;">0020</span> TITLEIMG <span style="color: #0000ff;">OF</span> oTitle BITMAP <span style="color: #ff0000;">"TIT_AGENDA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0052</span>,<span style="color: #000000;">0052</span> <br /> <br /> @ <span style="color: #000000;">0015</span>,<span style="color: #000000;">0120</span> TITLETEXT <span style="color: #0000ff;">OF</span> oTitle <span style="color: #0000ff;">TEXT</span> <span style="color: #ff0000;">"Agenda Telefônica"</span> <span style="color: #0000ff;">COLOR</span> nRGB<span style="color: #000000;">(</span><span style="color: #000000;">255</span>,<span style="color: #000000;">255</span>,<span style="color: #000000;">255</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">FONT</span> ARIAL14B <br /> @ <span style="color: #000000;">0040</span>,<span style="color: #000000;">0120</span> TITLETEXT <span style="color: #0000ff;">OF</span> oTitle <span style="color: #0000ff;">TEXT</span> <span style="color: #ff0000;">"CONTATOS"</span> <span style="color: #0000ff;">COLOR</span> nRGB<span style="color: #000000;">(</span><span style="color: #000000;">000</span>,<span style="color: #000000;">000</span>,<span style="color: #000000;">000</span><span style="color: #000000;">)</span> <span style="color: #0000ff;">FONT</span> ARIAL16B <br /> <br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBarAGENDA 3DLOOK <span style="color: #0000ff;">OF</span> oWndAGENDA <span style="color: #000000;">2015</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0078</span>,<span style="color: #000000;">0078</span><br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnADICIONAR <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"BAR_DLG_ADICIONAR"</span> <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Adicionar"</span> <span style="color: #0000ff;">FONT</span> ARIAL14B <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnVISUALIZAR <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"BAR_DLG_VISUALIZAR"</span> <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Visualizar"</span> <span style="color: #0000ff;">FONT</span> ARIAL14B<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnALTERAR <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"BAR_DLG_EDITAR"</span> <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Editar"</span> <span style="color: #0000ff;">FONT</span> ARIAL14B<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnEXCLUIR <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"BAR_DLG_EXCLUIR"</span> <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Excluir"</span> <span style="color: #0000ff;">FONT</span> ARIAL14B <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnRELATORIOS <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"BAR_DLG_RELATORIOS"</span> <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Relatórios"</span> GROUP <span style="color: #0000ff;">FONT</span> ARIAL14B <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnSAIR <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"BAR_DLG_SAIR"</span> <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Sair"</span> GROUP <span style="color: #0000ff;">FONT</span> ARIAL14B<br /> <br /> oBarAGENDA:<span style="color: #000000;">nTOP</span> = <span style="color: #000000;">200</span> <br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWndAGENDA <span style="color: #0000ff;">CENTERED</span> <br /> </div>[/code:3hfrdqjy]
I use it exactly in Dialogs, considering Dialog in ON INIT and it works perfectly. |
ButtonBar in a specific location ( Solved ) | Christiano, try with this, and tell me ( my name is Cristobal )
[code=fw:28amnv55]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"ttitle.ch"</span><br /><br /><span style="color: #00C800;">Function</span> Main<br /><br /> <span style="color: #00C800;">local</span> oTitle<br /> <span style="color: #00C800;">local</span> oBarAgenda<br /> <span style="color: #00C800;">local</span> oWndAgenda<br /> <span style="color: #00C800;">local</span> oBtnADICIONAR <br /> <span style="color: #00C800;">local</span> oBtnVISUALIZAR <br /> <span style="color: #00C800;">local</span> oBtnALTERAR <br /> <span style="color: #00C800;">local</span> oBtnEXCLUIR <br /> <span style="color: #00C800;">local</span> oBtnRELATORIOS <br /> <span style="color: #00C800;">local</span> oBtnSAIR <br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWndAGENDA <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">600</span>,<span style="color: #000000;">1041</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"GAM - AGENDA DE CONTATOS"</span> COLORS nRGB<span style="color: #000000;">(</span><span style="color: #000000;">215</span>,<span style="color: #000000;">243</span>,<span style="color: #000000;">366</span><span style="color: #000000;">)</span>,nRGB<span style="color: #000000;">(</span><span style="color: #000000;">215</span>,<span style="color: #000000;">215</span>,<span style="color: #000000;">215</span><span style="color: #000000;">)</span> NO MAXIMIZE<br /> <br /> @ <span style="color: #000000;">0000</span>,<span style="color: #000000;">0000</span> <span style="color: #0000ff;">TITLE</span> oTitle <span style="color: #0000ff;">OF</span> oWndAGENDA <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">1025</span>,<span style="color: #000000;">0059</span> NOBORDER <span style="color: #B900B9;">//PIXEL</span><br /> oTitle:<span style="color: #000000;">aGrdBack</span> := <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #000000;">1</span>,nRGB<span style="color: #000000;">(</span><span style="color: #000000;">150</span>,<span style="color: #000000;">150</span>,<span style="color: #000000;">150</span><span style="color: #000000;">)</span>,nRGB<span style="color: #000000;">(</span><span style="color: #000000;">150</span>,<span style="color: #000000;">150</span>,<span style="color: #000000;">150</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> oTitle:<span style="color: #000000;">nShadow</span> := <span style="color: #000000;">0</span><br /> <br /> @ <span style="color: #000000;">0010</span>,<span style="color: #000000;">0020</span> TITLEIMG <span style="color: #0000ff;">OF</span> oTitle BITMAP <span style="color: #ff0000;">"TIT_AGENDA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0052</span>,<span style="color: #000000;">0052</span> <br /> <br /> @ <span style="color: #000000;">0015</span>,<span style="color: #000000;">0120</span> TITLETEXT <span style="color: #0000ff;">OF</span> oTitle <span style="color: #0000ff;">TEXT</span> <span style="color: #ff0000;">"Agenda Telefônica"</span> <span style="color: #0000ff;">COLOR</span> nRGB<span style="color: #000000;">(</span><span style="color: #000000;">255</span>,<span style="color: #000000;">255</span>,<span style="color: #000000;">255</span><span style="color: #000000;">)</span><br /> @ <span style="color: #000000;">0040</span>,<span style="color: #000000;">0120</span> TITLETEXT <span style="color: #0000ff;">OF</span> oTitle <span style="color: #0000ff;">TEXT</span> <span style="color: #ff0000;">"CONTATOS"</span> <span style="color: #0000ff;">COLOR</span> nRGB<span style="color: #000000;">(</span><span style="color: #000000;">000</span>,<span style="color: #000000;">000</span>,<span style="color: #000000;">000</span><span style="color: #000000;">)</span><br /> <br /> <br /> @ <span style="color: #000000;">60</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">BUTTONBAR</span> oBarAGENDA 3DLOOK <span style="color: #0000ff;">OF</span> oWndAGENDA TOP <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0740</span>, <span style="color: #000000;">0078</span> <br /> oBarAgenda:<span style="color: #000000;">bRClicked</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">nil</span> <span style="color: #000000;">}</span><br /> oBarAgenda:<span style="color: #000000;">l2015</span> := .T.<br /> oBarAgenda:<span style="color: #000000;">nBtnWidth</span> := <span style="color: #000000;">120</span><br /> oBarAgenda:<span style="color: #000000;">nBtnHeight</span> := <span style="color: #000000;">78</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnADICIONAR <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Adicionar"</span> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnVISUALIZAR <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Visualizar"</span> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnALTERAR <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Editar"</span> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnEXCLUIR <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Excluir"</span> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnRELATORIOS <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Relatórios"</span> GROUP <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBtnSAIR <span style="color: #0000ff;">OF</span> oBarAGENDA <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Sair"</span> GROUP <span style="color: #0000ff;">ACTION</span> oWndAgenda:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWndAGENDA <span style="color: #0000ff;">CENTERED</span><br /> <br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /> </div>[/code:28amnv55] |
ButtonBar in a specific location ( Solved ) | It worked!
Thank you very much |
ButtonBar in resource ? | I know how to create a Function with a button bar and bitmap buttons, then place it on a dialog. This requires me to have one function for the dialog and all its controls, and then a second one for the button bar and buttons which is then painted on the ACTIVATE command.
This works, but actually I want everything in one METHOD rather than two functions. So for now, I can use BTNBMPs in the Dialog for the controls, and in the resource files I use PUSHBUTTON controls. It works fine, except.
Using the 2 function method, I get a nice button bar background. However, without the bar, the Brush ( a graphic ) I use is also behind the buttons.
So, I would like to paint the area behind the buttons to simulate the button bar.
Of course there are other issues, like the difficulty of having dynamic buttons, etc. With the old method, that is not a problem, but incorporating everything into one Method makes it difficult.
Has anyone played with this ? Of course the easiest solution would be if the Button Bar / Bitmap buttons could be put into the same code as all of the other controls, but that only works for windows and not Dialogs.
Your suggestions are appreciated. |
ButtonBar in resource ? | Tim,
The problem with the buttonbar is that is a control that will hold other controls, and a standard resources editor does not allows to define controls that belong to other controls. Thats why we did not implement a Class TBar Method Redefine().
Anyhow, I have implemented here for you and you will see that it works right, but there is no way to redefine the button, unless someone gets an idea of how to do it:
timbar.prg
[code=fw:2vmcdytt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBar<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"Test"</span> <br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">ID</span> <span style="color: #000000;">100</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #000000;">2007</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span> <br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:2vmcdytt]
timbar.rc
[code=fw:2vmcdytt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <windows.h><br /><br />test <span style="color: #0000ff;">DIALOG</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">186</span>, <span style="color: #000000;">94</span><br /><span style="color: #0000ff;">STYLE</span> DS_MODALFRAME | WS_BORDER | WS_DLGFRAME | WS_POPUP | WS_SYSMENU<br /><span style="color: #0000ff;">FONT</span> <span style="color: #000000;">8</span>, <span style="color: #ff0000;">"MS Sans Serif"</span><br />CAPTION <span style="color: #ff0000;">"Test"</span><br />BEGIN<br /> CONTROL <span style="color: #ff0000;">""</span>, <span style="color: #000000;">100</span>, <span style="color: #ff0000;">"TBar"</span>, <span style="color: #000000;">0</span> | WS_CHILD | WS_VISIBLE | WS_BORDER, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">200</span>, <span style="color: #000000;">40</span> <br /> DEFPUSHBUTTON <span style="color: #ff0000;">"OK"</span>, IDOK, <span style="color: #000000;">40</span>, <span style="color: #000000;">68</span>, <span style="color: #000000;">50</span>, <span style="color: #000000;">14</span>, WS_VISIBLE<br /> PUSHBUTTON <span style="color: #ff0000;">"Cancel"</span>, IDCANCEL, <span style="color: #000000;">101</span>, <span style="color: #000000;">68</span>, <span style="color: #000000;">50</span>, <span style="color: #000000;">14</span>, WS_VISIBLE<br />END</div>[/code:2vmcdytt]
FiveWin.ch
[code=fw:2vmcdytt]<div class="fw" id="{CB}" style="font-family: monospace;">#xcommand <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> <span style="color: #000000;">[</span><oBar><span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">ID</span> <nId> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <of: <span style="color: #0000ff;">OF</span>, <span style="color: #0000ff;">DIALOG</span>, WINDOW> <oWnd> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <span style="color: #0000ff;">SIZE</span> <nWidth>, <nHeight> <span style="color: #000000;">]</span>; <br /> <span style="color: #000000;">[</span> <l2007: <span style="color: #000000;">2007</span>, _2007> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <l2010: <span style="color: #000000;">2010</span>, _2010> <span style="color: #000000;">]</span> ;<br /> <span style="color: #000000;">[</span> <l2013: <span style="color: #000000;">2013</span>, _2013> <span style="color: #000000;">]</span> ;<br /> => ;<br /> <span style="color: #000000;">[</span> <oBar> := <span style="color: #000000;">]</span> TBar<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #0000ff;">Redefine</span><span style="color: #000000;">(</span> <nId>, <oWnd>, <nWidth>, <nHeight>,;<br /> <.l2007.>, <.l2010.>, <.l2013.> <span style="color: #000000;">)</span> </div>[/code:2vmcdytt]
bar.prg
[code=fw:2vmcdytt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> <span style="color: #0000ff;">Redefine</span><span style="color: #000000;">(</span> nId, oWnd, nWidth, nHeight, l2007, l2010, l2013 <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TBar<br /><br /> ::<span style="color: #00C800;">Super</span>:<span style="color: #0000ff;">Redefine</span><span style="color: #000000;">(</span> nId, oWnd <span style="color: #000000;">)</span><br /> <br /> ::<span style="color: #000000;">nBtnWidth</span> = nWidth<br /> ::<span style="color: #000000;">nBtnHeight</span> = nHeight<br /> ::<span style="color: #000000;">l2007</span> = l2007 <br /> ::<span style="color: #000000;">l2010</span> = l2010<br /> ::<span style="color: #000000;">l2013</span> = l2013<br /><br /> ::<span style="color: #000000;">SetGradients</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">Self</span> </div>[/code:2vmcdytt]
and
[code=fw:2vmcdytt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> SetGradients<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TBar<br /><br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br /> <span style="color: #00C800;">case</span> ::<span style="color: #000000;">l2007</span><br /> ::<span style="color: #000000;">bClrGrad</span> = <span style="color: #000000;">{</span> | lInvert | <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ! lInvert,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.25</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">219</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">244</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">207</span>, <span style="color: #000000;">221</span>, <span style="color: #000000;">239</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">0.75</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">201</span>, <span style="color: #000000;">217</span>, <span style="color: #000000;">237</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">231</span>, <span style="color: #000000;">242</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.25</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">253</span>, <span style="color: #000000;">222</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">231</span>, <span style="color: #000000;">151</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">0.75</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">215</span>, <span style="color: #000000;">84</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">233</span>, <span style="color: #000000;">162</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">case</span> ::<span style="color: #000000;">l2010</span><br /> ::<span style="color: #000000;">bClrGrad</span> = <span style="color: #000000;">{</span> | lInvert | <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ! lInvert,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">229</span>, <span style="color: #000000;">233</span>, <span style="color: #000000;">238</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">2</span>/<span style="color: #000000;">5</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">253</span>, <span style="color: #000000;">222</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">231</span>, <span style="color: #000000;">147</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">3</span>/<span style="color: #000000;">5</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">215</span>, <span style="color: #000000;">86</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">231</span>, <span style="color: #000000;">153</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">case</span> ::<span style="color: #000000;">l2013</span><br /> ::<span style="color: #000000;">bClrGrad</span> = <span style="color: #000000;">{</span> | lInvert | <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ! lInvert,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">194</span>, <span style="color: #000000;">213</span>, <span style="color: #000000;">242</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">194</span>, <span style="color: #000000;">213</span>, <span style="color: #000000;">242</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">otherwise</span><br /> ::<span style="color: #000000;">bClrGrad</span> = <span style="color: #000000;">{</span> | lInvert | <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> ! lInvert,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.25</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">219</span>, <span style="color: #000000;">230</span>, <span style="color: #000000;">244</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">207</span>, <span style="color: #000000;">221</span>, <span style="color: #000000;">239</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">0.75</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">201</span>, <span style="color: #000000;">217</span>, <span style="color: #000000;">237</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">231</span>, <span style="color: #000000;">242</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #000000;">0.25</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">253</span>, <span style="color: #000000;">222</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">231</span>, <span style="color: #000000;">151</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">0.75</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">215</span>, <span style="color: #000000;">84</span> <span style="color: #000000;">)</span>, RGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">233</span>, <span style="color: #000000;">162</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">endcase</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:2vmcdytt]
[img:2vmcdytt]https://bitbucket.org/fivetech/screenshots/downloads/timbar.JPG[/img:2vmcdytt] |
ButtonBar in resource ? | Antonio,
Thanks. That does allow for the resource to be used.
Maybe I'm missing something that may have been resolved in more recent versions. Use of DEFINE for the button bar and bitmap buttons would be fine IF I didn't have to create a separate function and then activate that when painting a dialog.
In other words, if ALL controls, including the button bar and bitmap buttons placed on it, could be combined in the same METHOD, that would be the optimum solution. Then it is easy to use dynamic buttons created by the program.
As an example:
DEFINE DIALOG oDlg .... OF oWnd
REDEFINE GET ....
REDEFINE GET ....
DEFINE BUTTONBAR oBar OF oDlg
DEFINE BUTTON .... OF oBar
DEFINE BUTTON ... OF oBar
ACTIVATE oDlg ....
Now we have to define the button bar and buttons in a separate function and call it with an ON PAINT in the ACTIVATE command.
Why is this important ? The Method has many variables which may need to be present in the called proceedures from the buttons. Each variable would have to be passed to the button bar control when it's a separate function, and that can be a lot of variables. It would be much nicer to keep them local, and have the buttons in the same method so they are always available. It's easier to update and debug also.
Tim |
ButtonBar in resource ? | [quote:22we5a2m]ON PAINT in the ACTIVATE command.[/quote:22we5a2m]
Should be ON INIT in the ACTIVATE command. Not ON PAINT. |
ButtonBar in resource ? | Actually it is, and it's been working fine that way for a long time ... just experimenting with ways to do it better with METHOD in a class ....
THE SOLUTION: I simply made both functions into METHODS in the same class, and now they work fine.
My goal has been to unify similar code and condense it, putting most procedures / functions into classes. It make the operation faster, easier to debug, and much easier to enhance. It's just a lot of work with such a large program. I'm condensing over 215 .prg files to under 100, and each will have a significant reduction in code.
Tim |
ButtonBar in resource ? | So, you want to create buttonbar and its buttons in the same function/method in which you create the dialog and also use the local variables of that function/method.
Can you please try this?
[code=fw:302z19fe]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br />#ifdef __XHARBOUR__<br /> #xtranslate BEGINBAR <span style="color: #0000ff;">OF</span> <o> => <o>:<span style="color: #000000;">bInit</span> := \<||<br /> #xcommand ENDBAR => \><br />#else<br /> #xtranslate BEGINBAR <span style="color: #0000ff;">OF</span> <o> => <o>:<span style="color: #000000;">bInit</span> := \<span style="color: #000000;">{</span>||<br /> #xcommand ENDBAR <span style="color: #000000;">[</span><*x*><span style="color: #000000;">]</span> => <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span>; <span style="color: #000000;">}</span> <x><br />#endif<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oDlg, oBar, oFont, oBrw<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-16</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">400</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">FONT</span> oFont TRUEPIXEL<br /><br /> BEGINBAR <span style="color: #0000ff;">OF</span> oDlg<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">64</span>,<span style="color: #000000;">32</span> <span style="color: #000000;">2007</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Top"</span> <span style="color: #0000ff;">ACTION</span> oBrw:<span style="color: #000000;">GoTop</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Bott"</span> <span style="color: #0000ff;">ACTION</span> oBrw:<span style="color: #000000;">GoBottom</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ENDBAR<br /><br /> @ <span style="color: #000000;">32</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE <span style="color: #000000;">{</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span>, <span style="color: #000000;">3</span>, <span style="color: #000000;">4</span>, <span style="color: #000000;">5</span> <span style="color: #000000;">}</span> NOBORDER<br /><br /> oBrw:<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #B900B9;">// do NOT use any ON INIT clause for this test</span><br /><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FOnt</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:302z19fe]
For this code to work, we need to make a small modification to dialog.prg.
In the method Activate, please locate the DEFAULT clause.
Add one more line DEFAULT bInit := ::bInit
After modification the Activate method of dialog.prg looks like this:
[code=fw:302z19fe]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">METHOD</span> <span style="color: #0000ff;">Activate</span><span style="color: #000000;">(</span> bLClicked, bMoved, bPainted, lCentered, ;<br /> bValid, lModal, bInit, bRClicked, bWhen, lResize16, ;<br /> lCenterInWnd <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TDialog<br /><br /> <span style="color: #00C800;">static</span> nDlgCount := <span style="color: #000000;">0</span><br /><br /> <span style="color: #00C800;">local</span> hActiveWnd, hWnd, bDlgProc<br /><br /> <span style="color: #00C800;">DEFAULT</span> lCentered := .f., lModal := .t., ::<span style="color: #000000;">hWnd</span> := <span style="color: #000000;">0</span>, lResize16 := .f., lCenterInWnd := .f.<br /> <span style="color: #00C800;">DEFAULT</span> bInit := ::<span style="color: #000000;">bInit</span> <span style="color: #B900B9;">// INSERTED NOW</span><br /> </div>[/code:302z19fe]
[url=https://imageshack.com/i/eyLVRxdtj:302z19fe][img:302z19fe]http://imagizer.imageshack.us/v2/xq90/538/LVRxdt.jpg[/img:302z19fe][/url:302z19fe]
If this approach works well then we can request Mr Antonio to consider making suitable modifications on these lines. |
ButtonBar in resource ? | Whenever you need to pass lots of variables, you should be using an object. Then you only pass one object and you can use or change as many variables as you wish in the function or method you are passing to. Further, you don't need to return the object as any changes you make will exist in the object that was passed.
I know you already know all this, but I thought little reminder might help (and help others). |
ButtonBar in resource ? | [quote="James Bott":6pqg15vu]Whenever you need to pass lots of variables, you should be using an object. Then you only pass one object and you can change as many variables as you wish in the function or method you are passing to.[/quote:6pqg15vu]
Mr James
There is no need to "pass" any variables. Lots or few, the code simply uses the local variables. |
ButtonBar in resource ? | Rao,
Yes, granted, not with your solution. However, I was answering his original question--and it applies to lots of other situations too.
James |
ButtonBar in resource ? | Tim,
Here is your example using an object.
[code=fw:2kscabkr]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">Local</span> oCustomer<br /> <span style="color: #00C800;">Local</span> cCustNo:=<span style="color: #ff0000;">"1007"</span><br /> <br /> oCustomer:= TCustomer<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span> cCustNo <span style="color: #000000;">)</span><br /> myFunction<span style="color: #000000;">(</span> oCustomer <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">(</span> oCustomer:<span style="color: #000000;">address</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><br /><span style="color: #00C800;">FUNCTION</span> MyFunction<span style="color: #000000;">(</span> oCustomer <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg .... <span style="color: #0000ff;">OF</span> oWnd<br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> .... oCustomer:<span style="color: #0000ff;">name</span><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">GET</span> .... oCustomer:<span style="color: #000000;">address</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTONBAR</span> oBar <span style="color: #0000ff;">OF</span> oDlg<br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> .... <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">ACTION</span> oCustomer:<span style="color: #000000;">save</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> ... <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">ACTION</span> oCustomer:<span style="color: #000000;">add</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> oDlg ....<br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span></div>[/code:2kscabkr] |
ButtonBar in resource ? | Mr James
If at all your code works, it should work with or without object and with or without a database.
The point is we can not define a buttonbar of a dialog within the same function (or method) that defines the dialog itself, whether from resource or source. The buttonbar has to be defined in the INIT clause of the ACTIVATE DIALOG command.
May I request you to post fully working code after testing at your end first? |
ButtonBar in resource ? | Good Afternoon,
Sorry for the delay. Rao I will work with your suggestion now and report back shortly.
Microsoft has a contest for Insiders that results in 2 days on campus meeting with senior staff. It requires a video explaining why we want to go. I just finished the recording and submitted my contest entry.
It would be a fun couple of days and very informative, but I expect there will be a lot of entries and only 10 people will be chosen.
A couple of things. 1) If I use two methods in a class, it does work. 2) Remember these are bitmap buttons, not straight buttons.
Tim |
ButtonBar in resource ? | James,
I'm way beyond that. Now I'm working on a class for my Vendor editor. I have a class for the vendor database, and one for the transaction database. Now I have the full screen editor which incorporates the browse and edit fields. All routines are called by bitmap buttons. It all works, but the button bar has to be created in a separate method and called in the ACTIVATE command. Previously these were two functions ( dialog and button bar ), now they are two methods. The idea is to see if I can bring the two across into the one method.
It's working ... just seeking one more way to reduce the overhead ! BTW, your example is what I've done throughout the program when obtaining data ... and when sharing it
Tim |
ButtonBar in resource ? | Rao,
That didn't work. First, the dialog and controls are from resources, and the buttons are bitmaps. That may play into this since "create from code" does not apply.
When trying it, the program just stopped working, and shows no error message.
Tim |
ButtonBar in resource ? | Mr Antonio
This is my feedback while testing the modified bar.prg for creating buttonbar from resource.
1) Defining buttons on the buttonbar still need to be done in the ON INIT clause only. This is not an issue but for clarification only.
2) While defining buttons, we get runtime errors because oBar:l3D, oBar:nBtnWidth and oBar:nBtnHeight remain nil. I suggest assigning suitable default values for l3D, nWith and nHeight in the method Redefine(). Because the bar is created from the resource, the height should be taken from the resource and should override whatever height the programmer defines in the command.
Can you please suggest the changes? |
ButtonBar in resource ? | Rao,
[quote:eue2cx6q]The point is we can not define a buttonbar of a dialog within the same function (or method) that defines the dialog itself, whether from resource or source. The buttonbar has to be defined in the INIT clause of the ACTIVATE DIALOG command.[/quote:eue2cx6q]
Yes, I understand that was your point.
My point was to show that you do not need to pass lots of variables to a function if you use an object. My point was separate from yours, and I apologize if you thought I was being critical of your solution. I was just showing a way that Tim's variable passing problem could be solved with the use of an object.
[quote:eue2cx6q]Tim said:
Each variable would have to be passed to the button bar control when it's a separate function, and that can be a lot of variables.
[/quote:eue2cx6q]
This can be solved this way:
ACTIVATE DIALOG oDlg ON INIT myFunction( oCustomer )
James |
ButtonBar in resource ? | James,
I should have said "objects". In an Edit dialog there may be multiple data objects involved, and other variables may be in play ( arrays, etc ). They may also be changing status during the use of the edit control. Yes, they can be passed, but it has the potential for being more complex. When everything is in the one method, it's just easier.
Tim |
ButtonBar in resource ? | Ok, you could create an object just to contain everything you want to pass. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.