FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help with button
Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
Help with button
Posted: Thu Nov 26, 2009 01:29 AM

Hi,

Why when I click on the button below, the button does not skip ? If I remove skinbuttons(), its ok.

include "fivewin.ch"

function main()
Local oDlg
Local oNum
Local cNum

skinbuttons()

if (!file("TestNum.dbf"))
tmpdbf:= {}
AAdd(tmpdbf, {"Num", "C", 40, 0})
dbcreate("TestNum.dbf", tmpdbf)
dbusearea(.T., Nil, "TestNum", Nil, Nil, .F.)
Append Blank
Replace Num With "One"
Append Blank
Replace Num With "Two"
Append Blank
Replace Num With "Three"
Append Blank
Replace Num With "Four"
Append Blank
Replace Num With "Five"
EndIf

use TestNum new
goto top

cNum:= TestNum->Num

DEFINE DIALOG oDlg FROM 0, 0 TO 26, 79 ;
TITLE "Test"

@ 9.95, 15.5 BUTTON "&NEXT" OF oDlg SIZE 40, 12 ;
ACTION ( Nextlast(), ;
cNum:= TestNum->Num, oNum:Refresh())

@ 9.95, 8.5 BUTTON "&TOP" OF oDlg SIZE 40, 12 ;
ACTION ( Toplast(), ;
cNum:= TestNum->Num, oNum:Refresh())

@ 9.95, 22.5 BUTTON "&PREV" OF oDlg SIZE 40, 12 ;
ACTION ( Prevlast(), ;
cNum:= TestNum->Num, oNum:Refresh())

@ 9.95, 29.5 BUTTON "&BOTTOM" OF oDlg SIZE 40, 12 ;
ACTION ( Botlast(), ;
cNum:= TestNum->Num, oNum:Refresh())

@ 9.95, 36.5 BUTTON "&END" OF oDlg SIZE 40, 12 ACTION oDlg:End()

        @ 0, 1 say "Number:"

        @  0, 10 say oNum VAR cNum OF oDlg SIZE 45, 11 COLOR CLR_GREEN

ACTIVATE DIALOG oDlg CENTERED

RETURN NIL


STATIC Function Toplast()

GOTO TOP

return nil


STATIC Function Nextlast()

TestNum->(dbskip())
if eof()
   msginfo("No More Record Found")
   GO BOTTOM
endif

return nil


STATIC Function Prevlast()

TestNum->(dbskip(-1))
   IF bof()
      msginfo("No Previous Record Found")
   GOTO TOP
endif

return nil


STATIC Function Botlast()

GO BOTTOM

return nil


Thanks

Regards

AC Woo
using fwh910+harbour+bcc55

Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: Help with button
Posted: Thu Nov 26, 2009 01:52 AM
acwoo1 wrote:Hi,

Why when I click on the button below, the button does not skip ? If I remove skinbuttons(), its ok.

#include "fivewin.ch"

function main()
Local oDlg
Local oNum
Local cNum

skinbuttons()

if (!file("TestNum.dbf"))
tmpdbf:= {}
AAdd(tmpdbf, {"Num", "C", 40, 0})
dbcreate("TestNum.dbf", tmpdbf)
dbusearea(.T., Nil, "TestNum", Nil, Nil, .F.)
Append Blank
Replace Num With "One"
Append Blank
Replace Num With "Two"
Append Blank
Replace Num With "Three"
Append Blank
Replace Num With "Four"
Append Blank
Replace Num With "Five"
EndIf

use TestNum new
goto top

cNum:= TestNum->Num

DEFINE DIALOG oDlg FROM 0, 0 TO 26, 79 ;
TITLE "Test"

@ 9.95, 15.5 BUTTON "&NEXT" OF oDlg SIZE 40, 12 ;
ACTION ( Nextlast(), ;
cNum:= TestNum->Num, oNum:Refresh())

@ 9.95, 8.5 BUTTON "&TOP" OF oDlg SIZE 40, 12 ;
ACTION ( Toplast(), ;
cNum:= TestNum->Num, oNum:Refresh())


@ 9.95, 22.5 BUTTON "&PREV" OF oDlg SIZE 40, 12 ;
ACTION ( Prevlast(), ;
cNum:= TestNum->Num, oNum:Refresh())


@ 9.95, 29.5 BUTTON "&BOTTOM" OF oDlg SIZE 40, 12 ;
ACTION ( Botlast(), ;
cNum:= TestNum->Num, oNum:Refresh())

@ 9.95, 36.5 BUTTON "&END" OF oDlg SIZE 40, 12 ACTION oDlg:End()

@ 0, 1 say "Number:"

@ 0, 10 say oNum VAR cNum OF oDlg SIZE 45, 11 COLOR CLR_GREEN

ACTIVATE DIALOG oDlg CENTERED

RETURN NIL
***************************
STATIC Function Toplast()

GOTO TOP

return nil
***************************
STATIC Function Nextlast()

TestNum->(dbskip())
if eof()
msginfo("No More Record Found")
GO BOTTOM
endif

return nil
***************************
STATIC Function Prevlast()

TestNum->(dbskip(-1))
IF bof()
msginfo("No Previous Record Found")
GOTO TOP
endif

return nil
***************************
STATIC Function Botlast()

GO BOTTOM

return nil
***************************

Thanks

Regards

AC Woo
using fwh910+harbour+bcc55

Hi
I test Antonio publish SkinButton demo EXE. I found if alwayse press button more times, focus or action not work like run loop.
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Help with button
Posted: Thu Nov 26, 2009 10:22 AM
acwoo1 wrote:Why when I click on the button below, the button does not skip ? If I remove skinbuttons(), its ok.


Your sample works fine here.

EMG
Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
Re: Help with button
Posted: Thu Nov 26, 2009 11:43 AM

Thanks for your help

When in "Next" button, and I click "Prev" button, the "Prev" is not processed. "Next" button flashes each time I click "Prev".

Thanks

Regards

AC Woo
fwh9.10+harbour+bcc55

Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
Re: Help with button
Posted: Tue Jul 06, 2010 01:18 PM

Hi,

If I click the 'Next' slowly, it runs OK. But if I click 'Next' too fast and then I click 'Prev', the program hangs.

Any help appreciated

ACWOO
Using fwh10.6 + bcc582 + harbour2.1.0

Continue the discussion