FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

TEXT

Solve a bug when dimming Edit Fields


If you attach a scroll bar to the EDIT FIELD; and fill the EDIT FIELD with text sufficient to activate the scroll bar; and then dim the EDIT FIELD; you will find that upon refresh the EDIT FIELD will blank-out portions of the area above the EDIT FIELD. In other words, if you have a graphic _above_ the EDIT FIELD, it will be erased by the refresh "EDIT FIELD #1 , , , _Framed" statement.

For example, the following code demonstrates what I'm talking about:

'--- will run as is ---

COMPILE 0,_dimmedVarsOnly
WINDOW OFF

_quitBtn = 10
DIM gQuit
END GLOBALS

'=================================================
'--------------- start of functions --------------
'=================================================

'=================================================
'--------------- Build window --------------------
'=================================================

LOCAL FN BuildWnd
  DIM rect;8
  DIM a$
  DIM i

  WINDOW 1,"Test",(0,0)-(160,260),_docNoGrow
  CALL SETRECT(rect,10,10,150,80)
  CALL INVERTRECT (rect)

  CALL SETRECT(rect,10,100,140,200)
  EDIT FIELD -1,"",@rect,_framed

  rect.left% = rect.right% + 1
  rect.right% = rect.left% + 16
  CALL INSETRECT (rect,0,-2)
  SCROLL BUTTON -1, 1, 1, 1, 1, @rect, _scrollOther

  BUTTON _quitBtn,_activeBtn, "Quit", (50,220)-(100,245),_push

  a$ = "test" + CHR$(13)
  FOR i = 1 TO 20
    a$ = a$ + "test" + CHR$(13)
  NEXT
  EDIT$(1) = a$

END FN

'=================================================
'----------------- doDialog ----------------------
'=================================================

LOCAL FN doDialog
  DIM evnt
  DIM id

  evnt = DIALOG(0)
  id = DIALOG(evnt)
  SELECT evnt
    CASE _btnClick
      SELECT id
        CASE _quitBtn
          gQuit = 1
      END SELECT
    CASE _MFEvent
      SELECT id
        CASE _mfResume
          EDIT FIELD #1 , , , _Framed
        CASE _mfSuspend
          EDIT FIELD #1 , , , _statFramedGray
      END SELECT
  END SELECT
END FN

'=================================================
'-------------------- MAIN -----------------------
'=================================================
"MAIN"

gQuit = 0

FN BuildWnd

ON DIALOG FN doDialog

DO
  HANDLEEVENTS
UNTIL gQuit

'--- end of code ----

Try running the above code and you will see that scrolling the EDIT FIELD and dimming the window will create a problem with refresh. My questions, what is it? And how do I get rid of it?

Many thanks to those who look into this.

tedd


The following code will gray an Edit Field and its text when the window is in the background and return it to its normal state when brought to the foreground. EF scroll button settings are retained.

COMPILE 0,_caseInsensitive

LOCAL FN Frame(type%,textColor%)
  current%=BUTTON(1) 'Get scroll position
  GET FIELD EFHndl&,1
  EDIT FIELD#-1,&EFHndl&,,type%
  KILL FIELD EFHndl&
  SETSELECT 0,32767
  EDIT TEXT ,,,,textColor%,textColor%,textColor%
  SETSELECT 0,0
  SCROLL BUTTON#-1,current% 'Reset scroll position
END FN

LOCAL FN BuildWnd
  WINDOW 1,"Gray EF",(0,0)-(160,260),_docNoGrow
  EDIT FIELD#2,"",(10,10)-(150,80),_statNoFramedInvert
  EDIT$(2)="Move scroll. Click off and on window."
  EDIT FIELD#-1,"",(10,100)-(140,200),_framed
  SCROLL BUTTON -1,1,1,1,1,(140,99)-(156,201),_scrollOther
  BUTTON#2,_activeBtn,"Quit",(50,220)-(100,245),_push
  a$ = "Item 1" + CHR$(13)
  FOR i = 2 TO 32
    a$ = a$ + "Item" +STR$(i) + CHR$(13)
  NEXT
  EDIT$(1) = a$
  SETSELECT 0,0
END FN

LOCAL FN doDialog
  evnt = DIALOG(0)
  id = DIALOG(evnt)
  SELECT evnt
    CASE _btnClick
      SELECT id
        CASE 2:END
      END SELECT
    CASE _wndClose
      END
    CASE _mfEvent
      SELECT id
        CASE _mfResume
          FN Frame(2,0) 'Black frame & text
        CASE _mfSuspend
          FN Frame(9,-36000) 'Gray frame & text
      END SELECT
  END SELECT
END FN

FN BuildWnd
ON DIALOG FN doDialog
DO
  HANDLEEVENTS
UNTIL 0

Steve Van Voorst