I have a dialog with multiple folders. Each has a button bar. One of the folders has an xbrowse. As I move up and down the browse rows, I want one of the buttons to be shown based on the value of the highlighted record.
For example, there are two buttons: ADD MEMBER
If the person highlighted is registered in a program, indicated by a field in their record, then I want the MEMBER button to show. If not, then the ADD button needs to show.
The button is one of many displayed on the button bar assigned to the folder.
Also, I can work with an alternative. On the dialog, when the change occurs in xbrowse ( to a different record ) the values shown in the edit fields of the dialogs ( not on the xbrowse ) also are updated to reflect the highlighted record. I can display the button on there and change it according to the status of the highlighted record . I could just display the image but it needs to have an action take place when it is pressed ....
Suggestions will be appreciated.
Tim
Dynamic button on buttonbar
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Dynamic button on buttonbar
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Dynamic button on buttonbar
Please try this sample. For this test, I have used customer.dbf in fwh\samples folder and used FIELD->MARRIED instead of Member/AddMember. But the principle is the same.
Upto version FWH17.06, prompt changes (Married/Single) when browse row is changed but bitmap does not change.
Please wait for a few days and run the same sample with FWH 17.07. Bitmap also change depending on the value of FIELD->MARRIED. This should work for you.
Upto version FWH17.06, prompt changes (Married/Single) when browse row is changed but bitmap does not change.
Please wait for a few days and run the same sample with FWH 17.07. Bitmap also change depending on the value of FIELD->MARRIED. This should work for you.
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oDlg, oBar, oBtn, oBrw
USE CUSTOMER
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL
DEFINE BUTTONBAR oBar OF oDlg SIZE 64,48 2007 GDIP
DEFINE BUTTON oBtn OF oBar ;
FILE "\fwh\bitmaps\user.bmp", "\fwh\bitmaps\users.bmp" ;
PROMPT { || If( CUSTOMER->MARRIED, "Married", "Single" ) } ;
ACTION If( CUSTOMER->MARRIED, MsgInfo( "MARRIED" ), MsgInfo( "SINGLE" ) )
if Val( HB_ATokens( FWVERSION )[ 2 ] ) > 17.06
oBtn:bBmpNo := { || If( CUSTOMER->MARRIED, 2, 1 ) }
endif
@ 50,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" ;
COLUMNS "FIRST","CITY","MARRIED","AGE" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:Married:SetCheck( nil, .t. )
:bChange := { || oBar:Refresh() }
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Dynamic button on buttonbar
OK ...
If instead of a button on the button bar, I decide to display a bitmap on a dialog. I want to display the bitmap depending on a value in the record highlighted in the browse. I've done this with text, but not a bitmap. What code would you suggest ?
Tim
If instead of a button on the button bar, I decide to display a bitmap on a dialog. I want to display the bitmap depending on a value in the record highlighted in the browse. I've done this with text, but not a bitmap. What code would you suggest ?
Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit