PINTAR CUADRO FRAME
Posted: Thu Jun 07, 2018 6:13 pm
Hola, es posible pintar el marco del FRAME.
Solo el marco.
Gracias
Solo el marco.
Gracias
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://www.hmgforum.com/
Code: Select all
#include "hmg.ch"
#include "hmg_BoxLetterShow.ch"
Function Main
*--------------------------------------------------------*
* (c) Mustafa López mustalopez@gmail.com
*--------------------------------------------------------*
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 460 HEIGHT 370 ;
TITLE "MiFrame" ;
FONT "Arial" SIZE 10 BACKCOLOR { 211,218,236 } ;
NOSIZE NOMAXIMIZE ;
MAIN ;
ON KEY ESCAPE ACTION Form_1.Release
MiFrame(050,150,175,50,"14a","Mi Frame", { 005,186,010 } , { 211,218,236 } )
MiFrame(150,150,175,50,"15a","Mi Frame", { 007,002,204 } , { 211,218,236 } )
MiFrame(250,150,175,50,"16a","..." , RED , VERDE ) // Opcional si no se pone nada "..." sale solo Rojo
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
Code: Select all
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// --> Repinta el cuadrado
// --> MiFrame("16","Mi Frame",BLUE,GREEN)
// --> Parametros (Ventana,"Nombre_l", "titulo", color1, color2)
//--> Estaria bien que la varible VENTANA tuviese el nombre de ventana que tiene el control label
//--> &Ventana..&Clavel02..Fontcolor:=RED ----- ¡¡PERO NO FUNCIONA!!
FUNCTION ReFrame(Ventana,cControl,cTexto,Color,ColorBackground)
Local clavel01 := ALLTRIM("Label_") + ALLTRIM(cControl)
Local clavel02 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "a"
Local clavel03 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "b"
Local clavel04 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "c"
Local clavel05 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "d"
Win_1.&Clavel02..BACKCOLOR := Color
Win_1.&clavel03..BACKCOLOR := Color
Win_1.&clavel04..BACKCOLOR := Color
Win_1.&clavel05..BACKCOLOR := Color
Win_1.&clavel01..BACKCOLOR := ColorBackground
Win_1.&clavel01..FONTCOLOR := Color
Win_1.&Clavel02..Refresh
Win_1.&Clavel03..Refresh
Win_1.&Clavel04..Refresh
Win_1.&Clavel05..Refresh
Win_1.&Clavel01..Refresh
RETURN
Code: Select all
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//--> una chorrada para que funcione la rutina que le sigue.., la de repintal el win_1
//--> y engañar al compilardor
STATIC FUNCTION PROBATURA
DEFINE WINDOW Win_1 ;
ROW 0 ;
COL 0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'Hello World!' ;
WINDOWTYPE MAIN
END WINDOW
Win_1.Center
Win_1.Activate
RETURN
Te mando un Sample , haber si puede servir ?
..., pero que pasa cuando quieres pintar el cuadro de otro color, osease, lo tengo en azul y lo quiero poner en rojo, o viceversa, dependiendo de que este activo o no los objetos que continene dicho FRAME
Code: Select all
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// --> Dibuja un cuadrado
// --> MiFrame(300,300,175,50,"16","Mi Frame",BLUE,GREEN)
// --> Parametros (Fila, Columna, Alto, Largo, "Nombre_l", "titulo", color1, color2)
FUNCTION MiFrame(nRow,nCol,nWidth,nHeight,cControl,cTexto,Color,ColorBackground)
Local clavel01 := ALLTRIM("Label_") + ALLTRIM(cControl)
Local clavel02 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "a"
Local clavel03 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "b"
Local clavel04 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "c"
Local clavel05 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "d"
LOCAL CurSRow1 := nRow
LOCAL CurSCol1 := nCol
LOCAL LastSWidth1 := nWidth
LOCAL LastSHeight1 := 1
LOCAL CurSRow2 := nRow
LOCAL CurSCol2 := nCol
LOCAL LastSWidth2 := 1
LOCAL LastSHeight2 := nHeight
LOCAL CurSRow3 := nRow
LOCAL CurSCol3 := nCol+nWidth
LOCAL LastSWidth3 := 1
LOCAL LastSHeight3 := nHeight
LOCAL CurSRow4 := nRow+nHeight
LOCAL CurSCol4 := nCol
LOCAL LastSWidth4 := nWidth + 1
LOCAL LastSHeight4 := 1
DEFINE label &clavel02
ROW CurSRow1
COL CurSCol1
WIDTH LastSWidth1
HEIGHT LastSHeight1
VALUE ""
FONTNAME "Arial"// "Ms Sans Serif"
FONTSIZE 09
TOOLTIP ""
FONTBOLD .T.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
HELPID Nil
VISIBLE .T.
TRANSPARENT .F.
ACTION Nil
AUTOSIZE .F.
BACKCOLOR Color
FONTCOLOR Nil
BORDER .F.
CLIENTEDGE .F.
END LABEL
DEFINE label &clavel03
ROW CurSRow2
COL CurSCol2
WIDTH LastSWidth2
HEIGHT LastSHeight2
VALUE ""
FONTNAME "Arial"// "Ms Sans Serif"
FONTSIZE 09
TOOLTIP ""
FONTBOLD .T.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
HELPID Nil
VISIBLE .T.
TRANSPARENT .F.
ACTION Nil
AUTOSIZE .F.
BACKCOLOR Color
FONTCOLOR Nil
BORDER .F.
CLIENTEDGE .F.
END LABEL
DEFINE label &clavel04
ROW CurSRow3
COL CurSCol3
WIDTH LastSWidth3
HEIGHT LastSHeight3
VALUE ""
FONTNAME "Arial"// "Ms Sans Serif"
FONTSIZE 09
TOOLTIP ""
FONTBOLD .T.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
HELPID Nil
VISIBLE .T.
TRANSPARENT .F.
ACTION Nil
AUTOSIZE .F.
BACKCOLOR Color
FONTCOLOR Nil
BORDER .F.
CLIENTEDGE .F.
END LABEL
DEFINE label &clavel05
ROW CurSRow4
COL CurSCol4
WIDTH LastSWidth4
HEIGHT LastSHeight4
VALUE ""
FONTNAME "Arial"// "Ms Sans Serif"
FONTSIZE 09
TOOLTIP ""
FONTBOLD .T.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
HELPID Nil
VISIBLE .T.
TRANSPARENT .F.
ACTION Nil
AUTOSIZE .F.
BACKCOLOR Color
FONTCOLOR Nil
BORDER .F.
CLIENTEDGE .F.
END LABEL
DEFINE label &clavel01
ROW CurSRow1 - 8
COL CurSCol1 + 5
WIDTH LastSWidth1
HEIGHT LastSHeight1
VALUE cTexto
FONTNAME "Arial"// "Ms Sans Serif"
FONTSIZE 09
TOOLTIP ""
FONTBOLD .T.
FONTITALIC .F.
FONTUNDERLINE .F.
FONTSTRIKEOUT .F.
HELPID Nil
VISIBLE .T.
TRANSPARENT .F.
ACTION Nil
AUTOSIZE .T.
BACKCOLOR ColorBackground
FONTCOLOR Color
BORDER .F.
CLIENTEDGE .F.
END LABEL
RETURN NIL
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Esta funcion repinta el cuadro ya definido, y lo cambia de color
// Yo la uso cuando activo los GETS y quiero un golpe visual.
// Recibe
//--> Ventana : nombre de la Window que contiene el FRAME
//--> "16a" : Control definido previamente en el MiFrame
//--> Titulo : si le quieres poner un titulo visual al frame
//--> COLOR1, COLOR2 : La combinación de colores que más te guste.
// --> Repinta el cuadrado
// --> MiFrame(Ventana,"16a","Mi Frame",BLUE,GREEN)
// --> Parametros (Ventana,"Nombre_l", "titulo", color1, color2)
FUNCTION ReFrame(Ventana,cControl,cTexto,Color,ColorBackground)
Local clavel01 := ALLTRIM("Label_") + ALLTRIM(cControl)
Local clavel02 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "a"
Local clavel03 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "b"
Local clavel04 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "c"
Local clavel05 := ALLTRIM("Label_") + ALLTRIM(cControl)+ "d"
Local cn
SetProperty(Ventana, Clavel02, "BackColor", Color)
SetProperty(Ventana, Clavel03, "BackColor", Color)
SetProperty(Ventana, Clavel04, "BackColor", Color)
SetProperty(Ventana, Clavel05, "BackColor", Color)
SetProperty(Ventana, Clavel01, "BackColor", ColorBackground)
SetProperty(Ventana, Clavel01, "FontColor", Color)
SetProperty(Ventana, clavel02, "Refresh")
SetProperty(Ventana, clavel03, "Refresh")
SetProperty(Ventana, clavel04, "Refresh")
SetProperty(Ventana, clavel05, "Refresh")
SetProperty(Ventana, clavel01, "Refresh")
/*
Asi lo tenia antes, y obligatoriamente la ventana se llamaba win_1, cuando tienes solo una WIN_1 activa
no hay problemas, pero cuando hay más de una o le cambias el nombre......
Win_1.&clavel02..BACKCOLOR := Color
Win_1.&clavel03..BACKCOLOR := Color
Win_1.&clavel04..BACKCOLOR := Color
Win_1.&clavel05..BACKCOLOR := Color
Win_1.&clavel01..BACKCOLOR := ColorBackground
Win_1.&clavel01..FONTCOLOR := Color
Win_1.&Clavel02..Refresh
Win_1.&Clavel03..Refresh
Win_1.&Clavel04..Refresh
Win_1.&Clavel05..Refresh
Win_1.&Clavel01..Refresh
*/
RETURN