TBTNBMP with Recource - Button Prompt

Post Reply
angelo.c
Posts: 36
Joined: Thu Mar 30, 2006 11:19 am

TBTNBMP with Recource - Button Prompt

Post by angelo.c »

Hello everyone,

I have just upgraded from "FiveWin++ 1.82 - February 2004" to FW++ 7.01 and upgraded Alaska XBase++ Intl V1.81 to Intl V1.90.331. I use BorlandC Resource Compiler brcc32 V5.02 to manage my resources.

I have a problem with the TBTNBMP class not showing my button "Prompt" defined in the resource *.rc file. Buttons like "OK" and "Cancel" are my most used prompts. I have looked through the news group but can't seem to find anything that directly answers my question.

A small simplified example follows:

TEST1.PRG Source Follows:
#include "FiveWin.ch"
function MAIN ()
local cTitle,oWindow,oBar, oBtn[ 3 ]
cTitle := "Testing Access to Class variables and methods "
DEFINE WINDOW oWindow FROM 2,0 TO 35, 90 TITLE cTitle
SET MESSAGE OF oWindow DATE KEYBOARD
DEFINE BUTTONBAR oBar OF oWindow SIZE 35,25 _3D
DEFINE BUTTON oBtn[ 1 ] OF oBar ACTION MsgInfo("Button one(1) pressed") TOOLTIP "Press for Testing of Button One"
DEFINE BUTTON oBtn[ 2 ] OF oBar ACTION MsgInfo("Button two(2) pressed"), Brwse_Cust();
TOOLTIP "Press for Testing of Button Two and executing Browse Class"
ACTIVATE WINDOW oWindow
return nil

//**********************************************************
procedure Brwse_Cust()
local oWin, oCustBrwse
oCustBrwse := ACBrwCust():new()
oCustBrwse:BrwseCust()
return

//***********************************************************
CLASS ACBrwCust
EXPORTED: // Variables and Methods that follow are "public"
DATA DBFAlias
DATA oTmpDBF, CustAcct
DATA Init_OK

METHOD Init() CONSTRUCTOR
METHOD BrwseCust() //Browse Data Base

ENDCLASS

***********************************************************
***********************************************************
* Method..: New
***********************************************************
METHOD Init() CLASS ACBrwCust
// Now initialise all Class variables
::DBFAlias := "Some Alias"
return nil


METHOD BrwseCust() CLASS ACBrwCust
local oDlg2
DEFINE DIALOG oDlg2 RESOURCE "Brwse1Cst"
REDEFINE BTNBMP ID 1000 OF oDlg2;
ACTION (MsgInfo("If Displayed ... Button press works OK" ))

// REDEFINE BTNBMP ID 1001 PROMPT "Can" OF oDlg2; <-- If used Shows Prompt "Can" in button
REDEFINE BTNBMP ID 1001 OF oDlg2 ACTION (oDlg2:End())

ACTIVATE DIALOG oDlg2
return Nil


************************************************************
* DbeSys() is always executed at program startup for Alaska XBase++
************************************************************
PROCEDURE dbeSys()
SET COLLATION TO SYSTEM
SET DATE TO SYSTEM
RETURN



TEST1.RC resource Source Follows:

Brwse1Cst DIALOG -16, 1, 526, 315
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Customer Browse Showing Most Fields"
FONT 8, "MS Sans Serif"
{
PUSHBUTTON "&Toggle ", 1000, 148, 300, 66, 14
PUSHBUTTON "&Cancel ", 1001, 274, 300, 50, 14
}


----------------------------------------------------------------------------
I build the above using (a slightly modified for directory locations) FW++ Build32.bat file as build32 test1
When I run the programme the buttons dont' have any Text asssociated with them.


Do I have to use the >--> PROMPT "Some text here" <--< at the source code level or am I missing something where I can define the prompts in *.rc file

I had been using the BUTTON class before in my previous versions and it seemd to the work then. If I try and use the button class with this version the command:
REDEFINE BUTTON ID 1000 OF oDlg2 .....
leads to an error like >the "redfine" method is not allowed in this context<

Any suggestions would be appreciated.

Thanks in advance for any help given. :D
Angelo
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Angelo,

We have emailed you a modified Five32rt.dll that should fix it,

We appreciate your feedback,
regards, saludos

Antonio Linares
www.fivetechsoft.com
angelo.c
Posts: 36
Joined: Thu Mar 30, 2006 11:19 am

Post by angelo.c »

Many thanks Antonio. The new Five32rt.dll file fixed the prompt displays on the buttons.

Also thanks for pointing out the following:
"There is a mistake in your code: If you use a REDEFINE BTNBMP ... then in your RC file you have to use "TBtnBmp" (custom control) instead of a PUSHBUTTON.

But if you want to use a PUSHBUTTON in your resources then you have to use a REDEFINE BUTTON ... instead of REDEFINE BTNBMP ..."

In trying lots of differnt examples betwen using the BUTTON and TBTNBMP controls to try and find a solution to the problem, my resource file got out of sync with my source file.

Again thanks again for your support.

Best Regards,
Angelo
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Angelo,

You are welcome,

Class TBtnBmp is for pushbuttons with images on them. Class TButton is for Windows standard pushbuttons (without images).
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply