| EVENT ListBox6_OnClick(EventPtr event) { SelectedItem=ListBox6.ItemIndex(); FrmMemoContents.PopUp(); } EVENT FrmMemoList_OnOpen(EventPtr event) { Char Memos[500]=""; Char Title[50]; Int16 i,j; MemoDB.OpenRW('memo'); for(i=0;i<MemoDB.RecordCount();i++) { Int16 size=MemoDB.RecordSize(i); Char *cut,TmpStr[35]; MemoDB.Read(i,Title,50); cut=StrChr(Title,10); if (cut) *cut=0; if (size>28) Title[28]=0; for(j=0;j<StrLen(Title);j++) if (Title[j]==',') Title[j]=' '; if (StrLen(Memos)>0) StrCat(Memos,","); sprintf(TmpStr,"%d. %s",i+1,Title); StrCat(Memos,TmpStr); } ListBox6.Items=Memos; ListBox6.Draw(); } EVENT Button7_OnClick(EventPtr event) { SelectedItem=MemoDB.RecordCount(); FrmMemoContents.PopUp(); } |
EVENT Button10_OnClick(EventPtr event) { if(SelectedItem==MemoDB.RecordCount()) { MemoDB.Insert(SelectedItem,Edit8.Text(),StrLen(Edit8.Text())); } else { MemoDB.RecordSize(SelectedItem)=Edit8.Length(); MemoDB.Modify(SelectedItem,Edit8.Text(),Edit8.Length()); } FrmMemoContents.Back(); } EVENT FrmMemoContents_OnOpen(EventPtr event) { Char MemoContents[2048]; if(SelectedItem==MemoDB.RecordCount()) { Edit8.Text=""; } else { MemoDB.Read(SelectedItem,MemoContents,2048); Edit8.Text=MemoContents; } } |
From version 1.11 you have the possibility to update the TScrollBar indicator each time the user press a key (or introduces a character through graffiti). The code would look like this :
EVENT FrmMemoContents_OnKeyPress(WChar chr,UInt16 Modifiers)
{
if (FrmMemoContents.FocusedControl()==Edit8) {
ScrollBar9.GetValuesFrom(Edit8);
}
}