Page 1 of 1

press BUTTON Key ?

Posted: Fri Mar 28, 2008 4:41 am
by yunbg1
Hi all.

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

Code: Select all


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

Posted: Fri Mar 28, 2008 10:13 am
by Antonio Linares
Here you have a working sample:

Code: Select all

#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 ) }

Posted: Sat Mar 29, 2008 1:27 pm
by yunbg1
Hi Antonio Linares

Always thanks it gives too much in the reply which is kind.

Posted: Sat Mar 29, 2008 6:50 pm
by yunbg1
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


#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

Posted: Sat Mar 29, 2008 8:50 pm
by Antonio Linares
Here you have a working sample:

Code: Select all

#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

Posted: Sun Mar 30, 2008 6:27 am
by yunbg1
Hi Antonio Linares

Why the execution is not.

Code: Select all

#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