Search This Blog

Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts

Menu Designer in FoxPro

Menu Designer on Other of Project Manager allows you you build and edit menu or menus for your FoxPro System. On Prompt textbox, assign a name designated then on Result will appear Command, Pad Name, Submenu or Procedure. You can make as many list as you want. Then a textbox will appear on Options depends on what you had chosen on Result.

Balance Code

This code will check if textbox 1 is equal to textbox 2. If the two quantities is not equal a messagebox 'Not balance.' will appear but continue printing if balance at all.

IF !EMPTY(THISFORM.Text3.Value)
IF (THISFORM.Text1.Value) = (THISFORM.Text2.Value)
REPORT FORM "C:\GenLed\Reports\ReportJournalEntry" TO PRINTER PROMPT NODIALOG PREVIEW
THISFORM.Refresh()
ELSE
=MESSAGEBOX("Not balance.", "Confirmation")
ENDIF
ELSE
=MESSAGEBOX("Choose Journal Entry.", "Confirmation")
ENDIF

Do Case Code

DO CASE
CASE THISFORM.Text33.VALUE = "1"
THISFORM.Text22.Value = "ASSET"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "2"
THISFORM.Text22.Value = "LIABILITY"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "3"
THISFORM.Text22.Value = "CAPITAL"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "4"
THISFORM.Text22.Value = "OPN"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "5"
THISFORM.Text22.Value = "INCOME"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "6"
THISFORM.Text22.Value = "EXPENSE"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
ENDCASE

Avoid Backspace on Previous Textbox Code

Have you ever experience that when you press backspace and if the character on current textbox is fully deleted that it goes on previous textbox?

Try to put the following code on keypress of a textbox

IF EMPTY(THIS.SelStart)
IF NKEYCODE=127
KEYBOARD '{DNARROW}'
ENDIF
ENDIF

Changing Signatory Code

Most of the program I made out of FoxPro required signatory. This signatory can be achieve upon login into the system.

SELECT Signatory
LOCATE FOR signnum = 1
IF FOUND()
REPLACE SignName WITH THISFORM.Text1.Value
REPLACE SignPostion WITH THISFORM.Text2.Value
ENDIF
LOCATE FOR signnum = 2
IF FOUND()
REPLACE SignName WITH THISFORM.Text3.Value
REPLACE SignPostion WITH THISFORM.Text4.Value
ENDIF
LOCATE FOR signnum = 3
IF FOUND()
REPLACE SignName WITH THISFORM.Text5.Value
REPLACE SignPostion WITH THISFORM.Text6.Value
ENDIF
=MESSAGEBOX("Signatories successfully save.")

Determining First Character

If you wwould like to determine the first character or first three characters etc of your textbox, you can use below foxpro codes:

THISFORM.Text1.VALUE = LEFT(TRANS(THISFORM.Text2.Value),1)