press BUTTON Key ?

press BUTTON Key ?

Postby yunbg1 » Fri Mar 28, 2008 4:41 am

Hi all.

When anyone button or it pressed and which height should have fallen consecutively,
it will know how to peel?

Code: Select all  Expand view

oField := array(200)
count := 1

for i  := 1 to 50
    for j := 1 to 5
        @ (i*15), (j*30) BUTTONBMP oField[count] PROMPT "tete" OF oWndC SIZE 10, 10 PIXEL
        oField[count]:bAction := {|| test_button() }
        count += 1
   next
next

func test_button()

? -----------> Help me  !!! Push button what kind of button authorization

retu NIL
FWH User
FWPPC User
FWLinux User
yunbg1
 
Posts: 107
Joined: Sun Nov 13, 2005 12:40 am
Location: Winnipeg Canada

Postby Antonio Linares » Fri Mar 28, 2008 10:13 am

Here you have a working sample:
Code: Select all  Expand view
#include "FiveWin.ch"

Function main()

   local oWnd, oField := array(250), count := 1

   DEFINE WINDOW oWnd

   for i  := 1 to 50
       for j := 1 to 5
           @ (i*15), (j*30) BUTTONBMP oField[count] PROMPT "tete" OF oWnd SIZE 10, 10 PIXEL
           oField[count]:bAction := GenBlock( count )
           count += 1
      next
   next

   ACTIVATE WINDOW oWnd

return nil

func GenBlock( n )

return { || MsgInfo( n ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby yunbg1 » Sat Mar 29, 2008 1:27 pm

Hi Antonio Linares

Always thanks it gives too much in the reply which is kind.
FWH User
FWPPC User
FWLinux User
yunbg1
 
Posts: 107
Joined: Sun Nov 13, 2005 12:40 am
Location: Winnipeg Canada

Postby yunbg1 » Sat Mar 29, 2008 6:50 pm

Hi Antonio Linares

See this portion ( FUNC test_button(n) )
The contents of the 'oField[n]:cCapture' does not change.
Also neither the 'oField[n]:SetColor( CLR_WHITE, CLR_YELLOW )' Changes
When it is done how.

It is kind to a question always and answer back, it gives and the unit only it is grateful.

Code: Select all  Expand view

#define CR chr(13)

Function main()

   publ oWnd, oField := array(250), count := 1

   DEFINE WINDOW oWnd

   for i  := 1 to 50
       for j := 1 to 5
           cCap := CR + " " + CR + alltrim(tran(n,"999"))+" used"
           @ (i*15), (j*30) BUTTONBMP oField[count] PROMPT cCap OF oWnd SIZE 10, 10 PIXEL
           oField[count]:nStyle := nOr( oField[count]:nStyle, 8192 )
           oField[count]:bAction := GenBlock( count )
           count += 1
      next
   next

   ACTIVATE WINDOW oWnd

return nil

//------------------------------------------------
func GenBlock( n )
RETU { || test_button( n ) }

//------------------------------------------------
FUNC test_button(n)

oField[n]:cCaption := CR + "Not" + CR + alltrim(tran(n,"999"))+ CR + " used"
oField[n]:SetColor( CLR_WHITE, CLR_YELLOW )

oField[n]:Refresh()

RETU NIL
FWH User
FWPPC User
FWLinux User
yunbg1
 
Posts: 107
Joined: Sun Nov 13, 2005 12:40 am
Location: Winnipeg Canada

Postby Antonio Linares » Sat Mar 29, 2008 8:50 pm

Here you have a working sample:
Code: Select all  Expand view
#include "FiveWin.ch"

#define CR chr(13)

Function main()

   publ oWnd, oField := array(250), count := 1

   DEFINE WINDOW oWnd

   for i  := 1 to 50
       for j := 1 to 5
           cCap := alltrim(tran(count,"999"))+" used"
           @ (i*26), (j*75) BTNBMP oField[count] PROMPT cCap OF oWnd SIZE 70, 24 PIXEL
           oField[count]:nStyle := nOr( oField[count]:nStyle, 8192 )
           oField[count]:bAction := GenBlock( count )
           count += 1
      next
   next

   ACTIVATE WINDOW oWnd

return nil

//------------------------------------------------
func GenBlock( n )
RETU { || test_button( n ) }

//------------------------------------------------
FUNC test_button(n)

oField[n]:SetText( "Not " + alltrim(tran(n,"999")) + " used" )
oField[n]:SetColor( CLR_RED, CLR_YELLOW )

oField[n]:Refresh()

RETU NIL

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby yunbg1 » Sun Mar 30, 2008 6:27 am

Hi Antonio Linares

Why the execution is not.

Code: Select all  Expand view
#include "FiveWin.ch"

#define CR chr(13)

Function main()

publ oWnd, oField := array(250), count := 1 , oFont

DEFINE FONT oFont NAME GetSysFont() SIZE 0, -8

DEFINE WINDOW oWnd

   for i  := 1 to 50
       for j := 1 to 5

          @ (i*26), (j*75)  BITMAP oField[count] FILENAME "test.bmp" NOBORDER  SIZE 70, 24 OF oWnd ADJUST PIXEL

           oField[count]:bPainted  := { |hDC| OnPaint( hDC, str(count, 3), oFont ) ) }

           oField[count]:bLClicked := GenBlock(count)

           count += 1
      next
   next

ACTIVATE WINDOW oWnd

oFont:End()

return nil

//------------------------------------------------
func GenBlock( n )
RETU { || test_button( n ) }

//------------------------------------------------
FUNC OnPaint( hDC, cMsg, oFont )

local hOldFont

hOldFont := SelectObject( hDC, oFont:hFont )
SetBkMode( hDC, TRANSPARENT )
TextOut( hDC, 5, 5, cMsg )
SelectObject( hDC, hOldFont )

RETU NILl

//------------------------------------------------
FUNC test_button(n)

msginfo(n)

RETU NIL

FWH User
FWPPC User
FWLinux User
yunbg1
 
Posts: 107
Joined: Sun Nov 13, 2005 12:40 am
Location: Winnipeg Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 61 guests