[Gambas-devel] Wish: Html view for Data files in text editor.

ron ronstk at ...124...
Tue Oct 12 19:12:20 CEST 2004


HTML view for TextEditor form.
Esc key changes the view between HTML and Text.

In FTextEditor:

*******************************************************
Add a TextView control on form.
change name to HtmlView
*******************************************************
change in PUBLIC SUB _new(sPath AS String)
-----
  DrawTitle  
 
END
-----
to
-----
  DrawTitle
  
  ViewMode("text")
  IF Instr(UCase(Left(sText,128)),"<HTML") THEN ViewMode("html")
 
END
-----
*******************************************************
change Form_Resize:
-----
PUBLIC SUB Form_Resize()

  edtEditor.Move(0, 0, ME.ClientW, ME.ClientH)
  'lblCursor.Move(0, ME.ClientH - lblCursor.Height)
END
------
to
------
PUBLIC SUB Form_Resize()

  edtEditor.Move(0, 0, ME.ClientW, ME.ClientH)
  'lblCursor.Move(0, ME.ClientH - lblCursor.Height)
  HtmlView.Move(0,0, ME.ClientW, ME.ClientH)
END
------
*******************************************************
Add at end code:
------
PUBLIC SUB htmlview_KeyRelease()
  IF key.Code=key.Escape THEN ViewMode("text")
END

PUBLIC SUB edtEditor_KeyRelease()
  IF key.Code=key.Escape THEN  ViewMode("html")
END

PRIVATE SUB ViewMode(mode AS String)
  IF mode="html" THEN
    edtEditor.Visible=FALSE
    HtmlView.Visible=TRUE
    HtmlView.Text = edtEditor.Text
    HtmlView.SetFocus  
  ELSE
    HtmlView.Visible=FALSE
    edtEditor.Visible=TRUE
    edtEditor.SetFocus 
  ENDIF  
END
-----


grtz Ron




More information about the Devel mailing list