Buttons and ButtonBmps
--------------------------------------------------------------------------------
When I UPDATE() a Dialog, <Whenfunc> of a my Buttons is not updated; <Whenfunc> is controlled by an item of an array (empty or not empty) the array is evaluated every time I update my dialog. The item is rightly displayed on the dialog, but it doesn't change the button enabled/disabled property. Do somebody know why it?
There is a Method
AEvalWhen() from TWindow
Just do
oYour_Bar:AEvalWhen()
on all the places you needto refresh the buttons.
--------------------------------------------------------------------------------
does anyone knows how to change the button colors? ...
For the normal TBtn Class you can't as I know without changes in FW. But for TBtnBmp you can do it with SetColor().
I need to change the normal TBtn :}}} But i guess i have to change them on bitmap buttons...
--------------------------------------------------------------------------------
I've started playing with TBtnBmp class, and I wonder... is there a way to tell te control where to place the bitmap ?, I mean, align the bitmap to the left or to the right ?
I have had quite a problem with the TBtnBmp class starting with 1.9.5. Last night I pulled the fwbmp.obj out of the 1.9.2 FiveC and life came back to normal. As far as I can tell, ADJUST in 1.9.5 is simply broken, yielding a partial image, and failure to use ADJUST on a bitmap that is not perfectly sized gets you nothing. In 1.9.2 you could feed TBtnBmp an off-sized bitmap and it would force a fit. I need this as I have an application with some 5-600 bitmap buttons of varying sizes and user controllable colors. To avoid having to make over 100 bitmaps I simply have one for each color and let ADJUST do what it's advertised to do -- adjust the bitmap to fit the button. I'm having a similar problem with bitmaps in a tcbrowse in 1.9.5. It works fine in 1.9.2 but goes sour in 1.9.5. I have to move to 1.9.5 or possible 2.0 for TCP/IP support but may have to take some 1.9.2 objs with me. Sure wish Antonio hadn't fixed something that wasn't broken. Regarding your question about BMP placement, I think you will have to modify the ::paint() routine. I had to do so to place multiple text objects on the same button and found it rather straightforward.
The clause ADJUST of Btnbmp is not present anymore since version 1.95, the reason for that is due the display enhancement when the button is disabled, and also the enhancement that makess the buttons background color the same as your button face color on your windows desktop.
ADJUST is certainly present in my copy of 1.9.5. Do you mean 2.0??
Fivewin.ch 8/31/98
TBtnBmp.prg 9/16/98
But as I said, it doesn't appear to work.
--------------------------------------------------------------------------------
Does anyone knows how to build a button containing both icon and text (like the ones at the work bar at the bottom of the Windows 95 screen - the Start button, for example)?
Use PROMPT clause of REDEFINE BTNBMP command.
Take a look at the ::Paint() method in the TBtnBmp Class. That should give you the model.
--------------------------------------------------------------------------------
I've had this problem for so long I just forgot about it. Does anybody know why my disabled buttons (in a buttonbar) look this way ? Is there a way to fix it ?
ACTIVATE DIALOG oDlg ON INIT ( oBtn:Hide(), oDlg:UpDate())
Thanks, I will give it a try. I forgot to say that it only happens in my machine, in others where the program is installed it looks fine. I think it has something to do with some DLL, but I've checked and re-checked that there's only one version of CTL3D.dll in each computer.
Recheck APP directory and \windows\system,have CTL3D.dll ??
--------------------------------------------------------------------------------
i want to change caption of button, the problem is that button caption is "Ok" and then i press it i am change this with oButton:cCaption:="Save" but caption is not changed.
Try oButton:SetText("WhatEver") and then oButton:Refresh()
You have to use oButton:cTitle( "newtitle" ) not cCaption.
--------------------------------------------------------------------------------
How to change text of Button?? I try oBtn:cCaption := cText, oBtn:SetText( cText ), but, all fail!!
oBtn:cTitle := "Your_Text"
--------------------------------------------------------------------------------
The tButton.prg class creates buttons with a style that includes WS_TABSTOP How can I de-activate the tabstop property of a button created from source, after it is created??
Reassign nStyle in your source code like
oYour_Button:nStyle := nOr(what, ever, properties, you, need, here)
This won't work after the window has been activated.
Simply reassigning style is likely to make no effect.
OK, OK, I did not see that this is necessary to happen after activate the window/dialog. Of course it would not work just like :nStyle := (....) Attached is a little example with SetWindowLog and how to Deactivate / Activate button properties which of course would work not only for a button. ( T.PRG )
Thanks for the suggestions I will play with SetWindowLong and look up the various parameters in the MSDN
5. I don't know exactly, but the API SetWindowLong() allows to changeduring run-time some internal characteristic of the controls like style.
--------------------------------------------------------------------------------
I want to change BtnBmp button bitmaps,source code below:
Dialog
PUBLIC oBtn := Array(3)
Redefine BtnBmp oBtn[1] resource "NEW" of oDlg Action ChangeBMP()
Redefine BtnBmp oBtn[2] resource "EDIT" of oDlg
Redefine BtnBmp oBtn[3] resource "DEL" of oDlg
Function ChangeBMP()
oBtn[1]:LoadBitmaps("OK")
oBtn[2]:LoadBitmaps("Cancel")
oBtn[3]:Disable()
RETURN NIL
When I press first button "oBtn[1]",first button can change bitmap to resource "OK" and Third button can Disable itself.But only Second can't change bitmap to resource "Cancel".If I press Second button,it can auto change bitmap.Why??
ADD "UPDATE" after redefine BtnBmp ......
--------------------------------------------------------------------------------
I know FiveWin button style have two,one default windows button below:
redefine button ....... CANCEL
other bitmap button below:
redefine btnbmp .......
I want to add CANCEL function in BTNBMP button.How do I set? Please help me!
As I know you can. You have to change all your valid function to return true and in the function use the oGet:oJump to return to the get you are reading.Something like this:
IF Empty(cLiCodigo)
c5Stop('El código de libro es obligatorio, no puede quedar enblanco.')
oGet:oJump := oGet
SysRefresh()
Return .t.
ENDIF
--------------------------------------------------------------------------------
In my applications I use tbtnbmp for the dialog buttons, and I want to use 'direct accelerators' to them. I have accelerators to the tbtnbm buttons putting &Name to the control on Workshop, but when the user press ANT+N the button get the focus but is not pressed. I want if anybody knows how to do 'direct accelerators' to the btnbtm, that means that whr user press ALT-N the tbtnbmp exectures the action clause directly. It can't be done using bgotfocus because when the user select the buton using the tab key the action doesn't have to be done. Any ideas ?
You use button or buttonbar ?
I use tbtnbmp as buttons in my dialogs. You can see it in
www.jsnsoftware.com
What exactly do you mean by "puttind &Name to the control on Workshop"? If you could explain that I'll be one step ahead in doing what you want.
I define a generic control, and in the name field on workshop I write '&N' if I want the accelerator key to be N - for Nuevo.
Didn't know that tip. Let me experiment with it and I'll let you know.
This thing works even with a browse...
----------------------------------------------------------------------------------------------------------------------------------
I'm using buttons from resources
DEFINE BUTTON oBTN1 ID 101 .....
my problem comes when it gets the focus: How can I change the Tbutton, Tcontrol and / or Twindow classes in order to avoid the black rectangle that surrounds it ? My problem is that I already have tons of code that I can't rewrite again. So the solution (if it exists) have to come on this kind of button....
Uncheck the 'Border' Attribute from resource editor on this button From source define the button bitmap with NOBORDER
thank you for your help, but I did a little mistake. The sentence I use isn't
DEFINE BUTTON
but
REDEFINE BUTTON
into the .RC it's declared in this way:
CONTROL "INDEX", 798, "BorBtn", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, coords...
so the class I'm using is Tbutton() and not Tbtnbmp(). Tbutton() doesn't have the ::lBorder property so I suppose I should change the style but I don't know how.
I think you mustbe use TBtnBmp button to solve your problem.Below:
REDEFINE BTNBMP oBtn RESOURCE "BITMAPS" NOBORDER OF ...
Try This ( BUTTON.ZIP )
you did an excellent job and it will be very useful. But my trouble still remain. I will write you privately explaining what I'm meaning.
![Sad :-(](./images/smilies/icon_sad.gif)
sorry, Giovi, that you will explain with private email... The result may be interesting for many peoples: bitmaps as buttons which dont have the behaviour of standard Borlands buttons.
--------------------------------------------------------------------------------
Does anybody know how to change the color of a button? (from a resource) I tried after
REDEFINE BUTTON oButMenu ID 203 OF oDlg the following:
SetTextColor( oButMenu:hDC, CLR_RED )
SetBkColor( oButMenu:hDC, CLR_RED )
and
oButMenu:SetColor(CLR_RED,CLR_RED)
and
oButMenu:nClrText:=CLR_RED
oButMenu:nClrPane:=CLR_RED
and
DEFINE BRUSH oBrush COLOR CLR_RED
oBut:oBrush:=oBrush
All without any effect!
You cannot change the color of a standard Windows button (TButton class), I think.
Have you tried these things In the INIT cluase of the ACTIVATE WINDOW or DIALOG?
ACTIVATE DIALOG ON INIT ..
¿ Are you using Borland Buttons ? (you know, the ones with bitmaps inside them), if so, I'm sorry, you cannot change color to Borland Style Buttons since they are based on bitmaps, you'd better use TBNTBMP class.
Thank you all for your replies. The ON INIT sugestion does not work, it seems that Tbutton simply does not allow changing its color. The Tbtnbmp works just fine (just do not specify a bitmap) with changing colors, there is only a problem with a refresh after a double click. But this is resolved by adding the method LDblClick(). Further more method LButtonUp() needed a refresh() and a releasecapture().
--------------------------------------------------------------------------------
In the process of removing Borland buttons, I'm looking to convert more of my Buttons into BtnBmp buttons (which I've never bothered using until now, as a Borland button + bitmap has been quite suitable).
What's the trend? Are you guys tending to favour BtnBmps more and more, or trying to use basic Buttons wherever possible? What are the benefits and disadvantages?
(I don't have XP, but a few sample XP screens I saw on Patrick's site seem to mainly have the traditional buttons, albeit with rounded corners).
The only one I've used is a calendar in a third-party button get control. I tend to emulate Microsoft's interface styles. Granted MS doesn't do
everything the best way, but almost all computer users use MS products so the closer your program is to what they are used to, the better accepted it will be.
MS doesn't use many bitmap buttons.
I think you might find the following article on interface design quite interesting:
http://joel.editthispage.com/stories/storyReader$51
I also HIGHLY recommend Alan Cooper's book, "About Face" on interface design. I consider this to be the most important book on programming that I have. It is available at
www.Amazon.com.
--------------------------------------------------------------------------------
updating from fw 2.0 to 2.3, Buttons from source code are non displayed on dialogs. Obviously I'm doing something wrong, but I don't know what ! Here's the code :
DEFINE DIALOG oDlg1 FROM 00,00 TO 50,128 ;
OF oWnd ;
TITLE c_titolo ;
COLORS c_col_txt,c_col_bck
.........
@ 25,xB1 BUTTON oButCancel PROMPT cPrmCancel OF oDlg1 ACTION CARTELLE_D()
SIZE xBut/2,yBut/2
.........
ACTIVATE DIALOG oDlg1 CENTERED
On 2.2 version we had to change the buttons coordinates, to properly adjust to the new fonts management system.
You may use previous include\constant.ch and rebuild source\classes\button.prg, or change some contant.ch buttons related values to get a similar look.
We apologize for those changes, but there was the only way to implement fonts reuse on FW.
--------------------------------------------------------------------------------
Does anybody know how to use a hotkey for a BtnBmp like "&Close" with Alt-C without using the prompt-clause ?
If there is a menu, you can make it a menu choice. If it is on a dialog you can put an invisible button on it.
Good idea, but how can i disable these hidden buttons from tab in a selfdefinded dialog?
Just uncheck Tabstop on button properties.
--------------------------------------------------------------------------------
Please help me solve the problem. I have the dialog with LISTBOX and two BUTTONS created. The LISTBOX browses a databse file. I need to
enable/disable the button2 depending on the value of the field in the actual record, but it doesn't work. The button2 is
described this way:
REDEFINE BUTTON oBtn2 ID 140 OF oDlg ACTION MsgInfo('Button2') WHEN davka->pocet=0 //This should disable button depending on the value of the field
The ON CHANGE part of the listbox refreshes the oBtn2, but the button2 is always enabled.
Add the following to the ON CHANGE clause:
oDlg:aEvalWhen()
--------------------------------------------------------------------------------
Hello ! I'm using this class is some dialogs . I know that can assign to oBtnbmp:lCancel := .t. . In some cases I need default , but oBtnbmp:lDefault := .t. doesn't work . What to do in this situation ?
Try to trap Enter key.
Thank for your reply ! I tried your advise , but unsuccesfull .
At first I tried oGet:KeyDown := {|nKey| if( nKey == 13 , ... }
But I get an error : "No exported method : _Keydown
Then I wrote oDlg:bKeyDown := { |nKey| if( nKey == 13, ... }
But this can't to trap Enter ! What I'm doing wrong ?
Here is my source :
function MsgGet( cTitle, cText, uVar, lMask, uPict, oFont )
local oDlg, oBut1, oBut2
local oGet := uVar
local lOk := .f.
local nK1 := nK2 := n := j := m := nWd := nBt := 0
local nRg := 8
local nK3 := nK1 + 50
local nK4 := nK2 + 50
local oFnt := if( !empty( oFont ), oFont, oFont_pagr )
local nFh := oFnt:nHeight
local nFw := oFnt:nWidth
local nRw := nFh - 1
DEFAULT lMask := .f.
DEFAULT cText := if( lMask, if( cLg == "L", "Kodas :", "Code ( ID ) :" ), if( cLg == "L", "Kintamasis :", "Variable :" ) )
DEFINE DIALOG oDlg FROM nK1, nK2 TO nK3, nK4 PIXEL ;
TITLE cTitle FONT oFnt STYLE DS_MODALFRAME
j := oDlg:GetWidth( cText )
m := oDlg:GetWidth( strtran( uVar, " ", "W" ) )
nWd := j + m + 40
j := j / 2
m := m / 2
@ nRw, 3 SAY cText SIZE j + 2, nFh PIXEL FONT oFnt OF oDlg
if lMask == .t.
@ nRw, j + 10 GET oGet SIZE len( uVar ) * nFw, nFh PIXEL PASSWORD FONT oFnt OF oDlg
else
if !empty( uPict )
@ nRw, j + 10 GET oGet SIZE len( uVar ) * nFw, nFh PIXEL FONT oFnt PICTURE uPict OF oDlg
else
@ nRw, j + 10 GET oGet SIZE len( uVar ) * nFw, nFh PIXEL FONT oFnt PICTURE "@!K" OF oDlg
endif
endif
nRw += nFh + 4
@ nRw, nRg BTNBMP oBut1 SIZE nBut_w, nBut_h ;
NAME "Ok" OF oDlg ACTION ( lOk := .t., oDlg:End() )
oBut1:cToolTip := cGerai
nRg += nBut_w
@ nRw, nRg BTNBMP oBut2 SIZE nBut_w, nBut_h ;
NAME "Cancel" OF oDlg ACTION oDlg:End()
oBut2:cToolTip := cCancel
oBut2:lCancel := .t.
nBt := ( nRw + nBut_h * 2 ) * 2 + 10
oDlg:bKeyDown := { |nKey| if( nKey == 13, ( lOk := .t., oDlg:End() ), ) }
ACTIVATE DIALOG oDlg ON INIT ;
( oDlg:Move( nK1, nK2, nWd, nBt ), oDlg:Center() )
if lOk == .t.
uVar := oGet
endif
return lOk
Many thanks for any help !
There are some errors in your code. This is a working version:
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL cVar := SPACE( 20 )
LOCAL oFnt
DEFINE FONT oFnt NAME "Arial" SIZE 0, -10
MSGGET( "Prova", "Testo", @cVar, .T., , oFnt )
RELEASE FONT oFnt
RETURN NIL
function MsgGet( cTitle, cText, uVar, lMask, uPict, oFont )
local oDlg, oBut1, oBut2
local oGet
local lOk := .f.
local nK1 := nK2 := n := j := m := nWd := nBt := 0
local nRg := 8
local nK3 := nK1 + 50
local nK4 := nK2 + 50
local oFnt := if( !empty( oFont ), oFont, oFont_pagr )
local nFh := oFnt:nHeight
local nFw := oFnt:nWidth
local nRw := nFh - 1
DEFAULT lMask := .f.
DEFAULT cText := if( lMask, if( cLg == "L", "Kodas :", "Code ( ID ) :" ), if( cLg == "L", "Kintamasis :", "Variable :" ) )
DEFINE DIALOG oDlg FROM nK1, nK2 TO nK3, nK4 PIXEL ;
TITLE cTitle FONT oFnt STYLE DS_MODALFRAME
j := oDlg:GetWidth( cText )
m := oDlg:GetWidth( strtran( uVar, " ", "W" ) )
nWd := j + m + 40
j := j / 2
m := m / 2
@ nRw, 3 SAY cText SIZE j + 2, nFh PIXEL FONT oFnt OF oDlg
if lMask == .t.
@ nRw, j + 10 GET oGet VAR uVar SIZE len( uVar ) * nFw, nFh PIXEL PASSWORD FONT oFnt OF oDlg
else
if !empty( uPict )
@ nRw, j + 10 GET oGet VAR uVar SIZE len( uVar ) * nFw, nFh PIXEL FONT oFnt PICTURE uPict OF oDlg
else
@ nRw, j + 10 GET oGet VAR uVar SIZE len( uVar ) * nFw, nFh PIXEL FONT oFnt PICTURE "@!K" OF oDlg
endif
endif
nRw += nFh + 4
@ nRw, nRg BTNBMP oBut1 SIZE 20, 20 ;
NAME "Ok" OF oDlg ACTION ( lOk := .t., oDlg:End() )
oBut1:cToolTip := "Tooltip"
nRg += 20
@ nRw, nRg BTNBMP oBut2 SIZE 20, 20 ;
NAME "Cancel" OF oDlg ACTION oDlg:End()
oBut2:cToolTip := "Cancel"
oBut2:lCancel := .t.
nBt := ( nRw + 20 * 2 ) * 2 + 10
oGet:bLostFocus := { |nKey| if( GetKeyState( VK_RETURN ), ( lOk := .t., oDlg:End() ), ) }
ACTIVATE DIALOG oDlg ON INIT ;
( oDlg:Move( nK1, nK2, nWd, nBt ), oDlg:Center() )
if lOk == .t.
// uVar := oGet
endif
return lOk
Thank you ! Now this is working OK .
you missed the "b" oGet:bKeyDown := ...
--------------------------------------------------------------------------------
I need emulate an CLAUSE CANCEL of button class without button, or an function with send an cancel (Gets) of dlg.
You may set any control <oControl>:lCancel = .t.
--------------------------------------------------------------------------------
how to change the button text color ?
==> oBtn:cTitle
Have you tried oBtn:SetColor( nForeground, nBackground )?
Do it in the On init clause in the Activate Dialog command
--------------------------------------------------------------------------------
I try to DISABLE button when user empty edittext and ENABLE while they type something in edittext. But the button did not ENABLE.
DEFINE DIALOG oDlg RESOURCE 'TEST'
REDEFINE GET oGet VAR cText ID 101 OF oDlg
REDEFINE BUTTON oBtn ID 102 OF oDlg WHEN !empty(cText)
ACTIVATE DIALOG oDlg
Thanks in advance for any idea,
Try calling oDlg:aEvalWhen() inside the ON CHANGE clause of the REDEFINE GET command.
Thanks Enrico, but it's still not work. I don't know why?
The problem lies in the fact that ON CHANGE clause is evaluated *before* the pressed key is assigned to the GET variable. TGet class would need a fix. Anyway, this is a (ugly!) workaround:
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oGet, oBtn
LOCAL cVar := SPACE( 10 )
DEFINE DIALOG oDlg
@ 1, 1 GET oGet VAR cVar OF oDlg;
ON CHANGE ( oGet:Assign(), IF( nKey >= 32 .AND. nKey <= 126, oBtn:Enable(), IF( EMPTY( cVar ), oBtn:Disable(), oBtn:Enable() ) ), .T.
)
@ 3, 1 BUTTON oBtn PROMPT "Button" OF oDlg;
WHEN !EMPTY( cVar )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
Try this instead:
REDEFINE BUTTON oBtn ID 102 OF oDlg WHEN !empty(oGet:oGet:varget())
Note that there is a double oGet (because there is a Clipper get object inside the FW get object). I think you need to use this to get the data from
inside the get buffer. I don't think cText is updated until the get is exited.
Tried. No difference at all. Anyway, I use cVar in my sample, notoGet:cText() method.
> Note that there is a double oGet (because there is a Clipper get object
> inside the FW get object). I think you need to use this to get the data from
> inside the get buffer. I don't think cText is updated until the get is
> exited.
As far as I know, the GET variable is constantly updated. Using cVar (the GET variable), oGet:cText() or oGet:oGet:VarGet() should get to the
same result.
Sorry, I meant to address my message to Dutch instead of to you.
> As far as I know, the GET variable is constantly updated. Using cVar
> (the GET variable), oGet:cText() or oGet:oGet:VarGet() should get to the
> same result.
I tried your example as posted and it worked perfectly. Good work.
No problem. I learned a lot from your messages.
> > As far as I know, the GET variable is constantly updated. Using cVar
> > (the GET variable), oGet:cText() or oGet:oGet:VarGet() should get to the
> > same result.
> I tried your example as posted and it worked perfectly. Good work.
Thanks, but it's really not a solution as clean as I would want to write. My personal TGet class have a better solution inside it.
Thanks a lot Enrico and Jame, It's work perfect.
I use (in similar cases following:
redefine button ........ when edtmode
edtmode is set to .T. or .F. depending on when the button should be enabled.
Works perfect.
I think so, but first step BUTTON is DISABLE because edittext is empty. When I type something BUTTON should be ENABLE but it's still DISABLE. I don't know why?
--------------------------------------------------------------------------------
How can I put a text consisting of 2 lines on a button?
Add to Style Button the number 8192
----------------------------
#define CR Chr( 13 )
//
FUNCTION uMultLineBtn_Test()
local oDlg, oBtn
local cCaption := 'Botones con...' + CR + ;
'caption multilínea.-' + CR + ;
'Para conseguirlo basta con emitir la sencilla sentencia...' + CR + ;
'oBtn:nStyle := ' + CR + ;
'nOr( oBtn:nStyle, 8192 )'
DEFINE DIALOG oDlg ;
FROM 00, 00 TO 17, 100 ;
TITLE cCaption
@ 03, 03 BUTTON oBtn PROMPT cCaption ;
OF oDlg ;
SIZE 100, 070
oBtn:nStyle := nOr( oBtn:nStyle, 8192 ) // this works fine!
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
Thank's James, i needed this too.
Do you know how to do this with a button from resources.... ?
I tried (obt:nstyle:=nor(obt:nstyle,8192); obt:settext('Regel 1'+CR+'Regel
2')) but with resources it does not work. The CR (I tried 13 & 141) are
shown as straight thick lines.
Any other ideas?
--------------------------------------------------------------------------------
I am still looking for a solution which enables me to put 2 (or even more) lines of text on a button which is created from a .dll resource. I've tried several things but still haven't found a working solution.
Haven't tried it, but maybe you can create the buttons as "generic controls" (ie like a TWBrowse or TCBrowse is handled), Then you could
add the BS_MULTILINE style there, ie, from inside Workshop
a) click on the "key" icon on the Tools floating window (third column,
at the bottom)
b) In the Class field enter (with quotes): "TButton"
c) In the Style field enter (without quotes): 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_MULTILINE
Let us know it that works.
You have to:
1. Open your DIALOG resource and go to Edit as text mode.
2. Add the value 8192 at the end of the PUSHBUTTON statement (separate it by a comma).
3. Inside the ON INIT clause of the DIALOG command use oBtn:cTitle() method to set the caption of the button (separate the lines by a CHR( 13
)).
That's all.
Thanks, works great! Gives a great addition to make-up dialogs
Certainly Enrico's code is simpler than my suggestion, mainly because I tried entering BS_MULITLINE instead of 8192, but BRW didn't recognize that constant (just like it doesn't reconginzes SS_SUNKEN).
> Certainly Enrico's code is simpler than my suggestion, mainly because I
> tried entering BS_MULITLINE instead of 8192, but BRW didn't recognize
> that constant (just like it doesn't reconginzes SS_SUNKEN).
The weird thing is if you enter 8192 and recompile then BRW replace it with BS_MULTILINE. But if you directly enter BS_MULTILINE then BRW won't recognise it.
Exactly. The same happens with SS_SUNKEN. You have to enter 0x1000 and when saved BRW translate it to SS_SUNKEN. Go figure!
How can you resolve this if you do not use Workshop?
Just using STYLE clause of @ row, col BUTTON command.
Thanks for your answer, Enrico. How do you use STYLE Clause?
A working sample follows:
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oBtn
DEFINE DIALOG oDlg
@ 1, 2 BUTTON oBtn PROMPT "Multiline" + CHR( 13 ) + "button" SIZE 50, 50
oBtn:nStyle = NOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP, 8192 )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
Enrico, do you know if it is possible to change the background colour of a button?
No. As far as I know, background color of standard Windows pushbuttons can't be changed. Maybe you can paint your own color over the existing one during ON PAINT event (not tested).
You can't. That's why Manuel Mercado (among other reasons) created the TSButton class.
--------------------------------------------------------------------------------