Home
API User Manual
Contents
1. MENU status KK define MENU DROPPED 1 define MENU UNDROPPED 0 78 FR FR ARS HRS SCROLLBAR styles HG 3K 2 3e 3K 3K 3K 3e FC FAS 3e ee 2 3e PC ke 3e 3e define VSCROLLBAR 0 define HSCROLLBAR 1 SCROLLBAR styles define VSPINBUTTON 0 define HSPINBUTTON 1 HS HH COMBOBOX styles define NO BORDER 1 define LEFT ALIGN 2 define COMBOBOX RIGHT ALIGN 4 define COMBOBOX NO ARROW 8 LinuxDA API User Manual 4 FORM Related Functions in mini gui h void init screen void Initialize the related devices the drivers of LCD amp Digitizer Sample Code This program is to demo how to use GetLaunchCommand PutAppInfo gt init_screen gt close_screen This is the main program GetLaunchCommand to parse the input parameter in command line Using its return value to decide to run the normal program or run PutAppInfo gt Normal program use init screen to initial the form Exit the form use close screen void main int argc char argv short launch cmd launch_cmd GetLaunchCommand argc argv switch launch_cmd case CMD RUN NORMAL init screen Sample close screen break case CMD RUN GET INFO PutAppInfo amp sample info break E void clo
2. you can set BUTTON NO BORDER if you hope to show a button has no border status 0 to invisible and COMPONENT VISIBLE for visible font which font to show the text of the button The FORM BUTTON in Figure 1 2 2 is defined in the form definition as below FORM BUTTON 40 20 20 40 20 Ok 0 COMPONENT VISIBLE FONT SMALL FORM BITMAP type FORM BITMAP id x y w h they are all available and w is the bitmap s width and the h is its height text point to a structure BITMAP you can find details in the definition Style you can set BORDER for showing a border outside the bitmap You can set BUTTON and then when clicked event will delay to happen when the pen up that means the bitmap will act as a button status the same as button font which font you use to show the text of the button In the Figure 1 2 6 each button is a bitmap for example the 9 button is realized as follows define b9 width 29 define 69 height 28 unsigned char b9 tb bitmap 1 0x00 0x 1F 0xC0 0x00 0x00 0xFF 0OxF8 0x00 0x03 0xFF OxFE 0x00 0x07 0xC7 0OxFF 0x00 0x0F 0x 1F 0xFF 0x80 0x 1E 0x7F 0xFF 0xC0 0x3C 0xFF OxFF 0xE0 0x39 0xFO 0x7F 0xE0 0x73 0xC0 0x IEOxF0 0x77 0xC2 0x 1 F 0xF0 0x67 0x87 0xOF 0xFO OxEF 0x87 0x0F 0xF8 0xEF 0x87 0xOF OxF8 0xFF OxC 1 0xOF 0xF8 0xFF 0xE0 0x0F 0xF8 OxFF 0OxF8 0x 1F 0xF8 0xFF OxFE 0x 1 F 0xF8 0x7
3. define 5 COUNT 16 52 LinuxDA API User Manual The Whole message queue flow chart Pen Interrupt occurred Save the S MESSAGE struct x y amp EVENT CLICK to low level message queue The flow chart of the processing message queue 53 GUI message queue management Get the form handle who request message check which component is clicked in and return the GUI MESSAGE structure include it s id it s event and the pen location x hibyte IParam y lobyte IParam LinuxDA API User Manual Application catches those Buffer of the messages that it needs and Message Queue send others to the system by DefaultMessageRoutine System receives those messages that the application not proecess and send Simple Example Here is a simple to show how to get the message and deal with it with the UI Pls notice 1 it s very easy to create a application and u needn t to use any function such as draw line draw rect to deal with the UI User Interface Don t forget to get the message by using function GetMessage 3 Don t forget to send the messages you do not process to the system by function DefaultMessageRoutine or some errors will be caused 4 Yes It s only the easy standard components can be use in this sample but if u wanna create ur own one why not try to use component BITMAP include lt stdio h gt include lt unistd h gt include
4. let it be status set it invisible or visible font which font you use to show the label FONT SMALL FONT MEDIUM FONT LARGE The FORM TEXTBOX in Figure 1 2 6 is defined in the form definition as below TEXTBOX textFirstName 3 Toris 32 1 0 1 16 LinuxDA API User Manual TEXTBOX textLastNamez 3 Chang 32 1 0 0 FORM TEXTBOX 10 35 5 60 0 amp textFirstName 0 COMPONENT VISIBLE FONT SMALL FORM TEXTBOX 20 35 25 60 0 amp textLastName 0 COMPONENT VISIBLE FONT SMALL FORM END It is the last line of the form definition Pls remember this line is necessary type be FORM END id x y w h text style status font let them be 3 FORM Constants These Marcos are defined in SER SSH Basic FORM elements type definitions 3K 3K 3K 3K 3K ee 2 3e ee 2 3e EC define FORM_CAPTION define FORM_LABEL define FORM_BUTTON define FORM_BITMAP define FORM_MENU define FORM_MENUITEM define FORM_SYSTEM define FORM_SCROLLBAR define FORM_TEXTBOX define FORM_SPINBUTTON 10 define FORM_CHECKBUTTON 11 define FORM_COMOBOX 12 define FORM_END 127 D I ON LN typedef struct short width height the size of the bitmap image void img point to the data of the bitmap usually the first address of array which expresses a bitmap char caption LinuxDA API User Manual 78
5. member fill index and mode is bypassed Sapmle Code See U8 GetIndexFromId FORM frm 08 id void CopyScreen U8 p U16 x U16 y U16 w U16 h Copy the screen image to memory which start at p x y w h image region of screen U8 p do NOT forget use some method such as malloc to assign a memory block to pointer p If you have malloced REMEMBER to free this block when you don not use it any longer This function is often used to save the screen display when you create another form That s to say save the background of the form because it is not safe sometimes that you set a form s status to be FORM SAVE BEHIND It often used with CopyScreen to fulfill save behind Sample Code see U8 MallocScreen U16 w U16 h 27 LinuxDA API User Manual void PasteScreen U8 p U16 x U16 y U16 w U16 h paste the contents of p maybe a bitmap to screen x y w h image region of screen Sample Code see U8 MallocScreen U16 w U16 h U8 MallocScreen U16 w U16 h According to the specified width amp height to assign a memory block Strongly recommend to use this function to assign memory if this memory block is for the screen operation purpose Sample Code This program demos the following APIs MallocScreen CopyScreen CreateForm CloseForm gt PasteScreen and FreeScreen allocate a block of memory and save the current screen into this memory block Create a new window and call the main l
6. char str GraphicsContext short font lib short align flag Try to display a string in a rectangle area if the specified string is out of the given regionjt will be clip to fit in the rectangle area 44 LinuxDA API User Manual Align flag can set how the string is aligned in the rectangle Sample Code void DisplaySomething char szMessage RECT rectRange GraphicsContext gc set up the area rectRange top 10 rectRange left 10 rectRange bottom rectRange top 100 rectRange right rectRange left 100 set up some attributes gc mode Mode SRC gc fill index WhitePattern gc color GUI BLACK call the function to display the string DrawStringInRect amp rectRange szMessage amp gc FONT SMALL Y ALIGN CENTER X ALIGN MIDDLB short gui how to char str This functions can display application s help The parameter is the text content of the application It will show a form as Figure 1 4 1 You need to control the format of the text in the string you transfer to this function This function return the keycode of RETURN if you exit the form by clicking RETURN key Calculator User Manual The top right listbox enable the ser to pick the three different Sample Code odestbasic scientific financial define STRING HOWTO CONTENT Snake The idea of the game is change the direction of the snake without its body touching the sides Th
7. char nick name 16 char version 16 char owner 32 char creator 32 BITMAP large icon BITMAP small icon APP INFO Applications running mode define CMD NORMAL 1 define CMD RUN GET INFO 2 endif Modify the main function of address void main int argc char argv short launch init screen launch emd GetLaunchCommand argc argv switch launch cmd case CMD RUN NORMAL OpenAddressDB OpenIRDA 32 LinuxDA API User Manual LoadAppStatus amp g last selected item amp g scr list position amp CardRec InitAddresstCategory GetListRegion WaitLoop O CloseIRDA 0 LDACloseDB g db handle 0 break case CMD RUN GET INFO PutAppInfo amp app info break close screen Some functions about textbox void Refresh TextBoxContents FORM txt short start pos short end pos short flag Refresh the content from position to in the textbox If flag is 1 the text box is changed immediately else the textbox is not changed You may be puzzled for what means of the textbox not immediately refreshed It is used in case that you only want to get the practical height of the textbox This function will calculate the height of the textbox and give it to the textbox component Remember the first argument txt point to the FORM structure which represents the textbox not the whole form Sample Code TEXTBOX
8. txt short line Set the textbox end line as line that means to change the parameter end line in TEXTBOX 35 LinuxDA API User Manual structure Remember the argument txt point to the FORM structure which represents the textbox not the whole form Sample Code void SetTextBoxVisibleLinesDemo int nVisibleLines int nIndex get ID get form index id for TextBox nIndex GetIndexFromId frmMainFrame TEXTBOX CONTENT ID Update TextBox Attribute SetTextBoxEndLine amp frmMainFrame nIndex nVisibleLines Refresh TextBox RefreshComponent nIndex frmMainFrame void SetTextBoxtEmptyLines FORM txt short line Set the textbox minimun empty lines as line that means to change the parameter min empty lines in TEXTBOX structure Remember the argument txt point to the FORM structure which represents the textbox not the whole form Sample Code void SetTextBoxEmptyLinesDemo int nEmptyLines int nIndex get ID get form index id for TextBox nIndex GetIndexFromId frmMainFrame CONTENT ID Update attribute for TextBox SetTextBoxEmptyLines amp frmMainFrame nIndex nEmptyLines Refresh TextBox RefreshComponent nIndex frmMainFrame void SetFocus FORM frm short id Set the component which id is id in the FORM frm as current focus It is often used in the textbox 36 LinuxDA API User Manual Sample code see SetTextBoxtStartLin
9. 0 0 OxFF OxFO 0x38 OxFF OxEO 0x48 OxFF 0x80 0x88 OxFF 0x01 0x08 OxFE 0x04 0x08 OxFC OxOE 0x18 0 8 Ox1E 0x38 0 0 Ox3F 0xF8 OxEO Ox 7F OxF8 OxEO OxFF OxF8 0 0 OxFF 0 8 0xC1 0x7F OxF8 0 2 Ox7F 0 8 4 Ox 7F OxF8 0 8 OxFF OxF8 OxDO OxFF OxF8 OxE3 OxFF OxF8 Ox7F OxFF 0 0 Ox3F OxFF OxEO 0x00 0x00 0x00 0x41 0x64 Ox6F 0x62 0x65 0x20 0x50 0x68 0 6 0 74 Ox6F 0x73 0x68 Ox6F 0x70 0x20 0x44 Ox6F 0x63 0x75 0 6 0x65 Ox6E 0x74 0x20 0x44 0x61 0x74 0x61 0x20 0x42 0 6 Ox6F 0x63 Ox6B 0x00 0x00 0x00 0x00 0x00 static unsigned char s icon bitmap Ox7F OxF8 OxFF 0 8 OxFE 0x04 OxFC 0x04 0 8 0x04 OxFO OxCC OxE1 OxFC 0xC3 OxFC 0x87 OxFC 0x83 OxFC 0x93 OxFC OxFC OxCF OxFC 0x7F OxF8 0x41 0x64 0 6 0x62 0x65 0x20 0x50 0x68 Ox6F 0x74 Ox6F 0x73 0x68 0 6 0x70 0x20 0x44 31 LinuxDA API User Manual Ox6F 0x63 0x75 0x6D 0x65 Ox6E 0x74 0x20 0x44 0x61 0x74 0x61 0x20 0x42 0x6C Ox6F 0x63 0 6 0x00 0x00 0x00 0x00 0x00 static BITMAP large icon l icon width 1 icon height l icon bitmap static BITMAP small 5 icon width s icon height s icon bitmap APP INFO app info Address 1 0 003 LinuxDA Inc LinuxDA Shanghai amp large icon amp small icon 12 app info h ifndef APP INFO H define APP INFO typedef struct
10. BUTTON 1 70 130 45 20 Accept 0 COMPONENT_VISIBLE FONT_SMALL FORM_END void Main void CreateForm frmAbout wait static void wait loop void 55 LinuxDA API User Manual U8 loopFlag 1 int i GUI_MSG msg PIXEL px while loopFlag GetMessage frmA bout amp msg switch msg event case EVENT_CLICK switch msg id case 1 click the button Accept and then close form and go out printf out of aboutin CloseForm frmAbout LoopFlag 0 break default All those clicking message not processed should be sent to system DefaultMessageRoutine frmAbout amp msg break break default All other type events not processed should be sent to system DefaultMessageRoutine frmAbout amp msg break 56 LinuxDA API User Manual 7 Database API This section introduces the database data definitions and functions In mini typedefint DBHANDLE General marcos of DB define FILENAME LENGTH 16 78 FR FR ARS 2 AR Definitions of field type of DB gt K gt K gt K define DBCHAR 0x0001 define DBINT 0x0002 define DBLONG 0x0003 define DBDATE 0x0004 define DBTIME 0x0005 define DBSTRING 0x0006 define DBBINARY 0x0007 define DBVARCHAR 0x0008 2 2 KK Definitions of record prop
11. such as the sub menu item will drop down while click the menu reverse the face of the button once pen down and restore the button face while pen up short SendKeyToForm FORM frm short code FORM the pointer of the whole form structure Code ASCII code of the character Sample Code void AddCharToTextBox int nCharCode NULL means the current Form nCharCode is its corresponding ASCII code SendKeyToForm NULL nCharCode Can send key to other form SendKeyToForm frmMainFrame nCharCode short GetCurrentActivated TextBox void Return the current active textbox ID Return 0 if there is no selected id Sample Code void ShowTextBoxID void int nCurrentTextBoxID char szMessage 32 48 LinuxDA API User Manual nCurrentTextBoxID GetCurrentActivatedTextBox if nCurrentTextBoxID sprintf szMessage Current Activated Text Box ID 96d 96 nCurrentTextBoxID else sprintf szMessage No TextBox Activated MsgBox szMessage LinuxDA MB OK static void pull up menu FORM dlg If there is some sub menu item is dropped while click in any other components or click in a empty area the menu will pull up automatically Function GetSelectedComponentld will invoke it static void drop down menu FORM mnu Auto drop dowm the menu Function GetSelectedComponentld will invoke it static void GetMenuRect RECT r FORM mnu return the rectangular region of the m
12. 10 temp top GetScreenHeight 2 10 temp bottom GetScreenHeight 2 10 SetAvailableRegion amp temp draw line 0 0 GetScreenWidth GetScreenHeight GUI BLACK temp left 0 temp rightzGetScreenWidth temp top 0 temp bottom GetScreenHeight SetAvailableRegion amp temp void draw pixel U16 x U16 y U8 color To draw a pixel in x y by using some color Sample Code This program demos the following APIs draw pixel draw line and draw ellipse void sample play23 PIXEL px GraphicsContext gc short idx short 1 1 2 2 gc color GUI BLACK gc mode Mode SRC gc fill index BlackPattern idxzGetIndexFromId sample BITMAP MAIN x sample idx x sample idx w 2 y sample idx y sample idx h 2 draw_pixel x y gc color xl sample idx x yl sample idx y x2 sample idx x sample idx w y2 sample idx y draw line x1 y1 x2 y2 gc color draw ellipse x y sample idx w 2 sample 1dx h 2 amp gc void draw line short x1 short y1 short x2 short y2 short color Draw a line from pixel x1 y1 to x2 y2 Sample Code see void draw pixel U16 x U16 y 08 color 24 LinuxDA API User Manual void xor draw line short x1 short y1 short x2 short y2 Use the mode XOR to draw a line It is offen used in drawing When the picture have background and you draw and modify some other graphics which may traverse existing picture if you use function draw line to draw and
13. any component u can imagine While the pen click in this component message EVENT CLICK will be returned if the pen is pulled up message EVENT PEN UP will be returned Here is the last line of the form definition Please remember this line is necessary Following are the comprehensive descriptions of all members we now have in FORM LinuxDA API User Manual FORM CAPTION This is the 1 item in your form definition The field type must be FORM CAPTION You can choose show it in different styles or not type must be FORM CAPTION id can be set to any value because it has no effect X Y W h x y is the coordinate of the left top point the form w is its width his its length text point to the struct FORMCAPTION which includes the caption content of the form typedef struct char str the form caption is a string void icon the form caption is an icon RECR r reserved system used JFORMCAPTION style related to how the FORM is shown Now there are four styles as follows A form sep can have one or more styles You can use 1 operand to connect them 1 FORM FRAME CAPTION If this style is set a caption Bar will be shown in the head of the form As the Figure 1 2 1 shown LinuxDA is the form caption If a form only has the style the caption include the black rectangle where the caption string display and the line under it The blanket area on the l
14. as the two ones of HideComponent Sample Code see void HideComponent short index FORM frm void RefreshComponent short index FORM frm When some component need to change while you do not want to create the form again you can use this function For instance when click a button a label in the form will be changed you can change the string the refresh the label The two arguments are as same as the two ones of HideComponent Sample Code This Program demos RefreshComponent API When the attribute of object was changed program should refresh the object RefreshComponent can refresh the object void sample_play25 short idx 29 LinuxDA API User Manual idxzGetIndexFromId sample eBUTTON SHOW BITMAP RefreshComponent idx sample void SetSpinButtonText Sample Code This program demos SetSpinButtonText API the arrow of SpinButton to change the text of SpinButton object 99 1 99 gt static sample_play27 short msgvalue short i i atoi spinbutton_sample str msgvalue if i lt 100 amp amp i gt 100 SetSpinButtonText amp sample GetIndexFromId sample SPINBUTTON_SAMPLE ito a i RefreshMultiLineString FORM txt short flag Refresh the content of the label If flag is 1 the text box is changed immediately else the textbox is not changed and this function only for calculating the size of the label Remember the first argument txt point to the FORM
15. changed and you need to carefully read the textbox details and try it for some times to be familiar with textbox type FORM TEXTBOX id set a value the left top point of the textbox W the textbox width Remember each line of a multiple lines textbox has the same width for it is aligned with the previous line h The whole height of the textbox Any value you set is invalid for it is controlled by system You can get it when you need this value Remember each line may has different height for the font height of different letters are not the same When you change the content of the textbox the height of the textbox will be changed correspondingly You can get the changed height value of the textbox from GUI MSG structure when you ended inputting EVENT INPUTCHAR The value in the structure of this GUI MSG whose event is EVENT INPUTCHAR is the offset value of the h in pixel unit text point to the below structure typedef struct short counter lines reserved char string 256 the string shown in the textbox short max char the maximum character amount the textbox can hold short min empty lines the minimum lines a textbox can be displayed in the screen when it is invisible short start line the line in the textbox will shown first in the screen short visible lines how many lines of the textbox will be visible in the screen style
16. i LDACloseDB g db handle 0 DBHANDLE LDAOpenDB char DBName short DBFlag Open a database whose name is DBName You can set DBFlag referring to the macro definitions Sample Code see int LDACreateDB char DBName short DBFlags DBFIELD dbField short dbFieldNumber int LDADeleteDB char DBName Delete the database whose name is DBName Sample Code include mini db h static void DeleteDB void int g db handle g db handle LDAOpenDB address 0 if g db handle 1 open database sucessfully LDACloseDB g db handle 0 LDADeleteDB address int LDACloseDB DBHANDLE fdidx short flag Close the database 62 LinuxDA API User Manual Sample Code see int LDACreateDB char DBName short DBFlags DBFIELD dbField short dbFieldNumber int LDASetDBCategory DBHANDLE fdidx char cate option It is an important function that will affect the records you want to get next If you set the category whose ID is cate option that means you make this category is current category And you can only get those records belonging to this category Sample Code see long LDAGetRecordNumber DBHANDLE fdidx int LDASetDBSecurity DBHANDLE fdidx char secu option Security is another special field something like category But it has only two choices DB SHOW SECURITY or DB HIDE SECURITY If he parameter secu option is set to DB HIDE SECURITY those records whose property security is RECORD SECURITY can not been got by those
17. in the range 0 59 but can be up to 61 to allow for leap second int tm min minutes after the hour 0 59 int tm hour hours after midnight 0 59 int tm mday day of the month 1 31 int tm_mon month of the year since January 0 11 int tm_year the number of year since 1900 int tm_wday day of week 0 6 int tm_yday day in the year 0 365 int tm_isdst daylight saving time struct tm representing broken down time which is binary representation separate into year month day etc Broken down time is stored in the structure tm which is defined in lt time h gt time t along integer represents calendar time When interpreted as an absolute time value jit represents the number of seconds elapsed since 00 00 00 on January 1 1970 Coordinated Universal Time 2 1 Some functions about time struct tm gmtime const time t timep converts the calendar time timep into broken down time representation expressed in Coordinated Universal Time struct tm localtime const time t timep converts the calendar time timep into broken down time representation expressed in local time time t mktime struct tm timeptr convert a local broken time to a calendar time int stime time t t set the system time as the value of t 69 LinuxDA API User Manual time t time time t t Time returns the time since the Epoch 00 00 00 UTC January 1 1970 mesured in seconds If t is non NULL the
18. lt fcntl h gt include lt sys mman h gt include lt sys types h gt include linux gui h 54 LinuxDA API User Manual include mini gui h static void wait loop void FORMCAPION form caption z About US static FORM frmAbout FORM CAPTION 0 0 0 160 160 amp form caption 0 COMPONENT VISIBLE FONT MEDIUM FORM MENU 10 5 20 0 0 Tools 0 COMPONENT VISIBLE FONT MEDIUM FORM MENUITEM 11 0 0 0 0 Digitizer 0 0 FONT MEDIUM FORM MENUITEM 12 0 0 0 0 About us 0 0 FONT MEDIUM FORM MENU 20 45 20 0 0 ABCD 0 COMPONENT VISIBLE FONT MEDIUM FORM MENUITEM 21 0 0 0 0 Digitizer O2 FONT MEDIUM FORM MENUITEM 22 0 0 0 0 About us 0 FONT MEDIUM FORM MENUITEM 23 0 0 0 0 Hi every body 0 FONT MEDIUM FORM MENU 30 90 20 0 0 LinuxDA 0 COMPONENT VISIBLE FONT MEDIUM FORM MENUITEM 31 0 0 0 0 Digitizer O2 FONT MEDIUM FORM MENUITEM 32 0 0 0 0 About us 0 FONT MEDIUM FORM MENUITEM 33 0 0 0 0 Hi every body 0 FONT MEDIUM FORM LABEL 0 8 35 60 60 CEO Paul Luang X ALIGN LEFTIY ALIGN MIDDLE COMPONENT VISIBLE FONT SMALLj FORM LABEL 0 8 50 60 60 COO Kiffin Tam X ALIGN LEFTIY ALIGN MIDDLE COMPONENT VISIBLE FONT SMALL FORM LABEL 0 8 65 60 60 My X_ALIGN_LEFTIY_ALIGN_MIDDLE COMPONENT_VISIBLE FONT_SMALL FORM_BUTTON 50 70 90 35 20 Click 0 COMPONENT_VISIBLE FONT_SMALL FORM
19. pointer of the form who wants to get the message Msg return message for more details pls see the next chapter Sample Code see void ClearMessageQueue void Void DefaultMessageRoutine FORM dlg GUI MSG msg This is a very important function to process the message Any message will not processed in you re application should be sent to the system by this function and those caught by your application should not be sent back If you perplex with it refer to the introduction of the message queue and the simple example in the back of this manual Sample Code see void ClearMessageQueue void Void SendMessage GUI_MSG msg Sample Code This program demo SendMessage API tshows you how to send the message It emulates CLICK event in menu void sample play20 GUI exit msg exit msg eventZEVENT CLICK exit msg id2MENUITEM MAIN EXIT SendMessage amp exit msg 42 LinuxDA API User Manual U8 lobyte U16 IParam Sample Code int EventClick_Process GUI_MSG pcusMessage int nStickPositionX int nStickPositionY char szMessage 32 int nResult pcusMessage gt id nStickPositionX hibyte pcusMessage gt Param nStickPositionY lobyte pcusMessage gt 1Param sprintf szMessage Current Click Position X d Y d nStickPositionX nStickPositionY MsgBox szMessage LinuxDA MB OK return nResult U8 hibyte U16 IParam Get
20. return value is also stored in memory pointed to by t 70
21. structure which represents the label not the whole form Sample Code char szLabelCaption 32 static FORM frmMainFrame FORM CAPTION 0 O 0 SCREEN WIDTH SCREEN HEIGHT amp cusFormCaption_MainFrame FORM FRAME CAPTION COMPONENT VISIBLE FONT SMALL FORM LABEL LABEL CONTENT ID 20 100 100 40 szLabelCaption X ALIGN LEFT Y ALIGN CENTER LABEL BORDER LABEL MULTILINE COMPONENT VISIBLE FONT SMALLj FORM END void RefreshDemo void 30 LinuxDA API User Manual int nIndex According ID to get form index ID for a label nIndex GetIndexFromId frmMainFrame LABEL CONTENT ID Update Label atribute sprintf szLabelCaption Hello World nLinuxDA refresh the multi line Label and get the line number for Label object RefreshMultiLineString amp frmMainFrame nIndex 1 Some fuctions about system register for applications short GetLaunchCommand int argc char argv Ask for system to translate the parameters passed to the application Sample Code see void init screen void void PutAppInfo APP INFO app info Register the application s information to the system Sample code take address for example Add a resource file address rsrc It is defined as follows include gui h gt Hdefine 1 icon width 21 define 1 icon height 21 define s icon width 14 define s icon height 14 static unsigned char 1 icon bitmap Ox3F OxFF OxEO Ox 7F OxFC
22. this field is set system GUI will back up the background picture before the new FORM display and the background of the FORM will be restore after function CloseForm is invoked There are other styles you can refer to behind details FORM BUTTON 1 70 130 45 20 This item defines a standard button String Accept will be Accept 0 COMPONENT VISIBLE shown as the text of the button the text in each button will BONT SMALL be automatic align to the middle and center of the rectangle area of the button Field id while click the button function GetMessage will return the id of the button Field status COMPONENT VISIBLE will set the button as visible FORM_MENU 20 45 20 0 0 ABC This item indicates a menu whose id is 20 will be shown D 0 COMPONENT VISIBLE FO and the pixel 45 20 is it s left top corner for this type NT SMALL component the width and the height will not available COZ my GUI will calculate the width and height automatically Here we set the width amp height as 0 The field text means that the text string of menu is ABCD FORM MENUITEM 21 5 20 0 0 Each menu should has it s sub menu In most cases the sub Digitizer 0 menu Will be drop down while click in the menu For this type of component the fields x y w d are all not 5 LinuxDA API User Manual FORM BITMAPA0 0 18 11 140 in tb BITMAP BUTTON COMPON ENT VISIBLE FORM END available A
23. 2 ADDRESS T rec addr rec1 rec2 char cat sec strcpy rec1 last name Johns strcpy rec 1 first_name Smith strcpy rec2 last name Philips strcpy rec1 first name Adams 65 LinuxDA API User Manual g db handle LDAOpenDB address 0 if g db handle 1 open database successfully cate_index1 LDAAddDBCategory g_db_handle Personal LDAAddRecord g db handle amp recl cate index1 DB SHOW SECURITY LDAAddRecord g db handle amp rec2 cate index2 DB SHOW SECURITY LDAGetRecord g db handle amp rec addr 0 amp cat amp sec LDAGetNextRecord g db handle amp rec addr amp cat amp sec LDADeleteRecord g db handle 0 LDAUpdateRecord g db handle amp rec1 0 cate index1 DB SHOW SECURITY LDACloseDB g db handle int LDADeleteRecord DBHANDLE fdidx short RecordId Delete a record And other records Ids may be changed Sample Code see int LDAGetRecord DBHANDLE fdidx void datalong RecordId char category char property int LDAUpdateRecord DBHANDLE fdidx void data short RecordId char category char property Updated a record Remember that other record Ids may be changed Sample Code see int LDAGetRecord DBHANDLE fdidx void datalong RecordId char category char property 66 LinuxDA API User Manual 8 Other functions This sections introduces some functions in the other libs you may need These libs always placed in the directory opt src LinuxD A pilot libgui void Showdate s
24. EM MAIN EXIT EXIT default DefaultMessageRoutine sample amp msg break default DefaultMessageRoutine sample amp msg 21 LinuxDA API User Manual U8 GetIndexFromId FORM frm U8 id Get the sequential number the location where it is defined in the form of the component whose idendity is the second parameter Sample Code program demos the following APIs GetIndexFromId draw_rect MsgBox According id to get the index number of the Control Use the index number to get parameters for arectangle and using those parameters to draw a rectangle and display a message void sample_play21 short id short idx GraphicsContext gc RECT temp idx GetIndexFromld sample id temp left sample idx x temp right sample idx x sample idx w temp top sample idx y temp bottom sample idx y sample idx h gc color GUI_BLACK gc mode Mode_SRC draw_rect temp amp gc MsgBox Do yuo see me sample MB_OK US GetScreenPtr void Get the screen pointer Yes the screen pointer is useful for some functions such as bitblt Sample Code define WIDTH 16 define HEIGHT 11 const unsigned char pcBitmapData OxFF OxFF 0x80 0x01 Ox8F OxF1 0x80 0x01 Ox8F OxF1 0x80 0 01 Ox8F 1 0x80 0 01 Ox8F OxF1 0x80 0 01 22 LinuxDA API User Manual OxFF OxFF void PaintBitmap short sPositionX short sPosit
25. F 0xFC 0x3F 0xF0 0x7F 0xF8 0x3F OxFO 0x7F 0xFO 0x7F 0xF0 0x3F 0xF9 0xFF OxE0 0x3F 0xFF OxFF OxE0 0x1F OxFF OxFF 0xC0 0x0OF OxFF OxFF 0x80 0x07 0xFF OxFF 0x00 0x03 0xFF 0xFE 0x00 0x00 OxFF 0xF8 0x00 0x00 0x 1F 0xC0 0x00 The array is got by a tool which can convert a tiff picture file to a text file const BITMAP b9 b9_width b9_height b9_tb_bitmap 11 LinuxDA API User Manual In the Figure 1 2 6 form the FORM BITMAP 9 is defined as follows static FORM frmBasic FORM_CHECKBUTTON The checkbutton is such a component as the am CheckButton shown in Figure 1 2 6 The check mark in the square indicates the check button is chosen am CheckButton L1 Win it k k D Es Figure 1 2 6 The FORM CHECKBUTTON is more complicate than the above components This component is composed of a 1 and a string type FORM_CHECKBUTTON id set a value as you want X y the coordinate of left top point h let them be System will generate the correct values according to the height and width of the string text point to a CHECKBOX structure which is defined in gui h typedef struct short value it will be 0 for not chosen status and 1 for chosen status hf you want to get the checkbutton s status you only need to know what the value is void caption the caption string will b
26. FR FR AR 2 HR For each component bit 7 Visible flag KK define COMPONENT_VISIBLE 0x80 define COMPONENT INVISIBLE 0 80 Button component style 3K 3K 3K 3K 3K gt K 3K 3K 3K 3K 3K 3K 3K 3K gt K 2K gt K PK KK define BUTTON NO BORDER 0x01 remove the border while display the button K K K K K K K K K K K K K K K K K Bitmap component style define BORDER 0 02 show border while display the bitmap define BUTTON 0x04 fase the bitmap as button It will process events when the pen up 78 FR FR AR 2 FORM Frame Styles aK a ak 3k 2e HG 3K 3K 3e 3e EFAS 2 3e define FORM FRAME CAPTION 0 01 define FORM FRAME BORDER 0x02 define FORM SAVEBEHIND 0x04 Auto save the background define FORM DLGFRAME 0x08 Caption width as same as the form Text alignment methods KK define X ALIGN LEFT 0x01 define X_ALIGN_MIDDLE 0x02 define X_ALIGN_RIGHT 0x04 define Y_ALIGN_TOP ox08 LinuxDA API User Manual define Y ALIGN CENTER Ox10 define Y ALIGN BOTTOM 0x20 ER 3K 3K 2 3e G2 K FS 2 3e Labelstyles define LABEL BORDER 0x40 define LABEL_MULTILINE 0x80 GE
27. LinuxDA API User Manual API User Manual LinuxDA API User Manual Table of Contents 1 BASIC DATA STRUCTURE 2 FORM DATA STRUCTURE 3 FORM CONSTANTS 4 FORM RELATED FUNCTIONS 5 GUI INTERNAL FUNCTIONS 6 MESSAGE QUEUE DEFINITIONS AND RELATED FUNCTION 7 DATABASE API 8 OTHER FUNCTIONS 9 STANDARD LINUX LIB FUNCTIONS 17 20 47 50 57 67 69 LinuxDA API User Manual API User Manual Since we develop the GUI ourselves We have to define every function data structure even the message queue But our target is to binary compatible Palm Application maybe we ll improve our API to follow Palm SDK later In this version of API We call each form as FORM that means the main windows of a application is a form a message box is also a form I know Palm SDK treat every window as Form Currently our applications are FORM based app And in each form we call the elements such as Button Label as Components FORM This section provides the following information about FORM 1 Basic data structure FORM data structure FORM constants FORM related functions GUI Internal functions Message queue definitions and related functions I t WN simple example to show how to use the GUI functions to get the message 1 Basic Data Structure These data structure are defined in gui h typedef unsigned char U8 typedef unsigned short U16 typedef uns
28. T NOTHING 0 define EVENT CLICK define EVENT INPUTCHAR 2 define EVENT KEYDOWN 3 define EVENT KEYUP 4 define EVENT PEN UP 5 define EVENT DESTROY FORM 6 50 LinuxDA API User Manual define EVENT SHOW MENUBAR 7 define EVENT HIDE MENUBAR 8 Event type Descriptions Event type Descriptions EVENT NOTHING No events EVENT CLICK This event will be sent to the message queue ceaselessly when the pen click the touch screen until the pen leaves the screen Caution A clicking that you feel may cause a couple of this type events EVENT INPUTCHAR The event happens when you leave the Keyboard form or Magic Pen form for inputting characters into a textbox EVENT KEYDOWN It is the event caused by pressing the hardware button Y EVENT KEYUP It is the event caused by pressing the hardware button A EVENT PEN UP The event happens when hen the pen leave the touch screen EVENT DESTROY FORM When the form is destroyed EVENT SHOW MENUBAR The event when the menubar is shown EVENT HIDE MENUBAR The event when the menubar is hidden I separate the message queue into two parts one is the low level and the other is hi level Consider the response time period of pen interrupt I don t want the interrupt program to get too much CPU s time So I DO simply queue the event CLICK and x y when the pen interrupt occurred Most of the applications only care about high level message queue At least I do think so Why a applica
29. That means applications can NOT call these functions directly In mini gui c inline void draw pixel U16 U16 y U8 color Use the specified color to draw a specified pixel Consider of the speed I define the function as a inline function This method may increase the invoke speed but will use more memory So strongly recommend NOT to invoke this function directly from the application inline void draw xish line U16 x U16 y U16 dx U16 dy U16 xdir U8 color inline void draw yish line U16 U16 016 dx U16 dy U16 xdir U8 color these two function is the sub routine of function draw line static void draw bitmap FORM mnu Maybe it s only for the test reason I only use this function to test the video frame buffer during the early period of my developing time DON T use this function static void draw menu FORM mnu According to the resource header to draw the menu The calculation of the location of the menu 47 LinuxDA API User Manual will be done in this routine static void draw form frame RECT r char str U8 style To draw the form border and the caption static draw button short x short y short w short h char str To draw the standard button of my GUI get static U8 GetSelectedComponentId PIXEL px FORM dlg It s the most complex function in the whole GUI This function will generate the high level message queue and do the default actions of standard components
30. a record by the first field Sample Code static void SearchRecord void 64 LinuxDA API User Manual short search id cate indexl cate index2 ADDRESS T rec addr recl rec2 char last name 100 cat sec strcpy rec1 last name Johns strcpy rec1 first name Smith strcpy rec2 last name Philips strcpy rec1 first name Adams g db handle LDAOpenDB address 0 if g db handle 1 open database successfully cate indexIZLDAAddDBCategory g db handle Personal LDAAddRecord g db handle amp recl cate index1 DB SHOW SECURITY LDAAddRecord g db handle amp rec2 cate index2 DB SHOW SECURITY strcpy last name Smith using lastname to find the record record ID saves at search id The record saves at rec addr search id LDAFindRecordByValue g db handle amp rec addr ast name amp cat amp sec LDACloseDB g db handle int LDAGetNextRecord DBHANDLE fdidx void data char category char property Get the next record Recommend using this function for it will speed the records searching Sample Code see LDAGetRecord DBHANDLE fdidx void datalong RecordId char category char property int LDAGetRecord DBHANDLE fdidx void data long RecordId char category char property Get the record by its ID The function put the found record into the data category id into categroy and property into propery SampleCode static void HandleRecordDemo void short cate indexl cate index
31. ainFrame nIndex szContent Refresh TextBox RefreshComponent nIndex frmMainFrame short GetTextBoxLines FORM txt Return the toatl lines that the textbox has Remember the argument txt point to the FORM structure which represents the textbox not the whole form Sample Code void ShowTextBoxLineCount U8 TextBoxID 34 LinuxDA API User Manual int nIndex int nTextBoxLineCount 0 char szMessage 32 nIndex GetIndexFromId frmMainFrame TextBoxID nTextBoxLineCount GetTextBoxLines sprintf sz Message TextBox Lines nTextBoxLineCount MsgBox szMessage LinuxDA MB OK void SetTextBoxtStartLine FORM txt short line Set the textbox start line as line that means to change the parameter start line in TEXTBOX structure Remember the argument txt point to the FORM structure which represents the textbox not the whole form Sample Code void Scroll TextBoxDemo int nStartPosition int nIndex get ID get form index id for TextBox nIndex GetIndexFromId frmMainFrame CONTENT ID Update attribute for TextBox gt It works when the actual line number in TextBox is bigger than nStartPosition SetTextBoxStartLine amp frmMainFrame nIndex nStartPosition Refresh TextBox RefreshComponent nIndex frmMainFrame After refresh TextBox SetFocus is required SetFocus frmMainFrame TEXTBOX CONTENT ID void SetTextBoxtEndLine FORM
32. d Switch the system to suspend mode It will save power if system is under this mode void PowerOff void Turn off the system void SetContrast shot contrast Set the screen contrast The contrast is expressed by a short number contrast void SwitchBackLight void Switch the status of the screen back light That is say if the back light is lid turn it off Otherwise turn it on Next three functions are used to control the volume of beep sound The application programmer can give distinct sound for different situation The volume of the beep is controlled by the system void SysBeepO Give off a beep about system void AlarmBeep Give off a beep when it is time to alarm void Give off a beep during the course of a game Some low level functions void OpenUART void Open the UART It is necessary to open before communicating with COM port void CIoseUART void Close the UART short ReadUART U8 data Read a byte from COM port and put the byte in the parameter data Return 0 if success and return 38 LinuxDA API User Manual if timed out short WriteUART U8 code Transit a byte code to COM port Return 0 if success and return 1 if timed out IRDA functions void OpenIRDA void Open the IRDA You must open the IRDA before communicating with other PDAs void CloseIRDA void Close the IRDA short ReadIRDA void data long size Read data from t
33. d name MAX FILENAME LENGTH shortfield length shortfield type DBFIELD Open Datebase flags 3e define DB READ ONLY 1 define DB EXCLUSIVE 2 define DB APPEND DATA 4 define DB PURGE DATA 5 K K K K K K K K K K K K K K K K K K K K K K Functions of DB KOK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Create a new database Return Value 1 Create failed none zero handle of the table eto ke 3e 3e J int LDACreateDB char DBName short DBFlags DBFIELD dbField short dbFieldNumber Create a new database Parameter 1 is the database name You can turn to the macro definition for DBFlags Pointer dbField point to a DBFILED structure which save the information about the database and dbField Number is the count of the fields in the db 59 LinuxDA API User Manual Sample Code static DBFIELD g db field detail last name 25 DBSTRING first name 25 DBSTRING h include mini db h static void OpenAddressDB void intg db handle g db handle LDAOpenDB address DB READ ONLY if g db handle 1 fail to open database LDACreateDB address DB SET OVERWRITE g db field detail sizeof g db field detail sizeof DBFIELD g db handle LDAOpenDB address DB READ ONLY LDAAddDBCategory g db handle Unfiled add initial catego
34. e can be 1 2 or 4 that means the data type is char short or int or long This function will return 0 if success and 1 if fail If the size is 2 the parameter reg must be the even address otherwise the function will return 1 And if the size is 4 reg must be the multiple of 4 For MOTOROLA Dragon Ball serial chipsets the register is the image of the memory address and this function can read memory directly short SetRegister U32 reg void data short size Set the data in the specified register The parameter represents the register and the data is the data in this register The parameter size can be 1 2 or 4 that means the data type is char short or int or long This function will return 0 if success and 1 if fail For MOTOROLA Dragon Ball serial chipsets the register is the image of the memory address and this function can read memory directly 032 SetCPUSpeed US US U8 freq U32 GetCPUSpeed US p U8 q U8 freq void DisableSysHardwarekb U8 kc Disable a hardware key And there is no message given when the key is pressed The parameter kc is the keycode of the key Remember to use the next EnableSysHardwarekb to reuse the key 40 LinuxDA API User Manual If you do not want to use this function for you may forgot to recover it There is another method Put a case sentence without processing instructions other than break into the switch one Therefore the
35. e int cate index g db handle LDAOpenDB address 0 if g db handle 1 open database sucessfully cate index LDA AddDBCategory g db handle Personal Record the Category ID of personal LDAUpdateDBCategory g db handle cate index Business LDACloseDB g db handle 0 int LDAGetDBCategoryTotal DBHANDLE fdidx Get the total number of categories in the database which handle is fdidx Sample Code see static void GetCategoryNameStr void int LDAGetDBCategoryAlphbet DBHANDLE fdidx int cate rank char cate name Get the category ID from the return value of this function Pls pay attention to cate rank Cate rank is not the ID of the category but the sequence index which is determined by sorting alphabetically And the string pointer cate name is the name of the category This function is very important to database programming if your database has categories You can get IDs and names of all categories by this function Sample Code static void GetCategoryNameStr void short i 61 LinuxDA API User Manual intg db handle intg cate total char g cate id 16 store the catogory IDs char g cate str 16 20 store the category names g db handle LDAOpenDB address 0 if g db handle 1 open database sucessfully g cate total LDAGetDBcCategoryTotal g db handle Get the total numbers of category for i 0 lt g_cate_total i g cate id 1 LDAGetDBCategoryAlphbet db handle g cate str
36. e FORM txt short line US PixelInRect PIXEL px RECT To check if a pixel in a rectangle region if yes return 1 Sample Code This program demos the follwing APIs GetScreenWidth GetScreenHeight gt PixelInRect xor draw line Define a square Its center is in the center of Window The length is 20 pixels Check px within this square If itis within the square fill the square f it is outside the square draw a diagonal line void sample play22 PIXEL px RECT temp GraphicsContext gc temp left GetScreen Width 2 10 temp right GetScreen Width 2 10 temp top GetScreenHeight 2 10 temp bottom GetScreenHeight 2 10 gc color GUI BLACK gc mode Mode_SRC gc fill_index BlackPattern if PixelInRect px temp 1 FillRect temp amp gc else xor draw line temp left temp top temp right temp bottom E 016 GetBatteryPower void Get the battery power Sample Code void ShowRestPower void int nCurrentPowerPercent char szMessage 32 nCurrentPowerPercent GetBatteryPower sprintf szMessage Current Power d 96 nCurrentPowerPercent MsgBox szMessage LinuxDA MB OK void SetAutoOffTime short time Set the waiting time before system automatic turn off the machine time is the number of the 37 LinuxDA API User Manual secondes short GetAutoOffTime void Get the waiting time before system automatic turn off the machine and return it void SuspendMode voi
37. e caption will not be shown status the status of a caption need not to consider for it has no meaning for the FORM CAPTION font what font you like FONT MEDIUM is commonly used in the caption The FORM CAPTION in Figure 1 2 1 is defined in a form definition as below FORMCAPTION form captionz LinuxDA FORM frmMain FORM CAPTION 0 0 0 159 159 amp from captionXFORM FRAME CAPTIOIN COMPONENT VIS IBLE FONT MEDIUM FORM END The FORM CAPTION in Figure 1 2 2 is defined in the form definition as below FORMCAPTION form 1 FORM CAPTION 0 20 20 80 60 amp form FRAME CAPTIONIFORM FRAME BORD ERIFORM DLGFRAMIFORM SAVEBEHIND COMPONENT VISIBLE FONT MEDIUM FORM LABEL LinuxDA API User Manual Last Hare Thompson Figure 1 2 4 Labels Labels are often used before other components to indicated what the meanings of them In Figure 1 2 4 Last Name and First Name are two labels type set to FORM LABLE id set a value X Y Wh they are all available text point to the label string style can set how the LABELS is aligned and shown There are 6 types of the alignment method to text which you can find behind You must set both x and y alignments or the label may not be properly shown Other styles LABEL BORDER The label has a border and this will make the label look like a button LABEL MULTILINE The label has m
38. e offset coordinates to the form left top corner text It s only a pointer for different components it has different meaning And this value can be NULL CAPTION pointer to FORMCAPTION structure LABEL the string of the label BITMAP the pointer of BITMAP structure LinuxDA API User Manual MENU the display string of the menu MENUITEM the display string of menu item CHECKBUTTON the pointer of CHECKBUTTON structure SCROLLBAR the pointer to SCROLLBAR structure TEXTBOX the pointer to TEXTBOX structure SPINBUTTON the pointer to SPINBUTTON structure Style Indicates the special styles of each kind of component Status Indicates the component is visible or invisible Font Specify the Font of the string in the component There is 3 types font in our GUL They are defined gui h The below is the simple description of our currently components you can find details and examples in the behind FORM CAPTION 0 0 0 159 159 This is the 1 item of your form definition The field type amp caption 0 COMPONENT_VISIBL must be FORM CAPTION E FONT SMALL Here we want our form s rectangular region is 0 0 to 159 159 and the caption of the form is About us which you can choose to show or not Of course you can show a form not so big In this case the field id can be set to any value If we set style to FORM FRAME BORDER the form will shown as a no border form If the bit FORM SAVEBEHIND in
39. e settings menu allows the user to adjust the speed stage and 45 Figue 1 4 1 LinuxDA API User Manual define the buttons The buttons that can be defined are the Schedule key the Address key the Up and Down Scroll keys the ToDo list and the Memo Pad keys int FunctionProcess GUI_MSG cusMessage int nResult 2 cusMessage id switch cusMessage id case MENU EXIT ID CloseForm frmMainFrame break case MENU HOWTO ID gui how to STRING HOWTO CONTENT break return nResult short gui about char title char version This functions can display an application s about The parameter title is application name And the version is the version string in format v x x xxx It will show a form as Figure 1 4 2 This function return the keycode of RETURN if you exit the form by clicking RETURN key LinuxD SN LS Copyright tc 2001 Empower Technologies All rights reserved w 1 0 001 Calculator Figue 1 4 2 Sample Code define STRING ABOUT VERSION 0 9 8 0 46 LinuxDA API User Manual int FunctionProcess GUI_MSG cusMessage int nResult 2 cusMessage id switch cusMessage id case MENU EXIT ID CloseForm frmMainFrame break case MENU ABOUT 1 gui about STRING ABOUT VERSIION break return nResult 5 GUI Internal Functions These functions are declared as static functions They will ONLY invoked by other GUI functions
40. e shown following the checked button JCHECKBUTTON style set how the checkbutton is shown status 0 to invisible and COMPONENT VISIBLE for visible font which font you use to show the caption The FORM CHECKBUTTON in Figure 1 2 6 is defined in the form definition as below CHECKBUTTON checkbutton 0 I am CheckButton FORM CHECKBUTTON 10 2 2 40 15 amp checkbutton O COMPONENT VISIBLE FONT SMALL 12 LinuxDA API User Manual FORM SPINBUTTON Now we have the vertical and horizontal style SPINBUTTONS If it is horizontal sytle spinbutton can hold a string between two arrows As Figure 1 2 6 show 5 is in the middle of the left and right arrow of the horizontal spinbutton But vertical spinbutton can not This component does not store any value like the position of SCROLLBAR A value may be 1 or 1 returned in the element value of data type GUI MSG when it is clicked type FORM SPINBUTTON id x y set as you need w h let these two members be system will set the w 11 d to 14 text point to the below structure typedef struct short spacing can leave some space between the two arrows char str 32 if HSPINBUTTON you can show text between the two arrows JSPINBUTTON style VSPINBUTTON or HSPINBUTTON statue visible or invisible font which font you use to show the text of the button Note while clicking the member val
41. ecordNumber g db handle total is 2 There are two records total LDAGetTotalRecords g db handle LDACloseDB g db handle 0 long LDAGetTotalRecords DBHANDLE fdidx Get the number of all record in the database whick handle is fdidx Sample Code see long LDAGetRecordNumber DBHANDLE fdidx int LDAAddRecord DBHANDLE fdidx void data char category char property Add a record to the database data is the record pointer and usually it is a structure representing a record category is the id of the category that this record belong to and the property is the security property which can be DB SHOW SECURITY or DB HIDE SECURITY If you set the record property as DB HIDE SECURITY the record is encrypted to some extent for you can no longer get the record by those functions such as LDAGetRecord unless you have used the function LDASetDBSecurity CAUTION All the records that we have added are SORTED by their first fields If we add a new record it is insert into the database by its first field and other records Ids may be changed Sample Code see long LDAGetRecordNumber DBHANDLE fdidx long LDAFindRecordBy Value DBHANDLE fdidx void data void CompareValue char category char property Find the record by some value of one field in the database which handle is fdidx Data is the found record if the function succeed If failed return the first record whose field is greater than the CompareValue CAUTION now we can only find
42. eft behind the rectangle can hold other components such as buttons combobox In Figure 1 2 1 the black bar on the center and the time string on the right do not belong to the form caption _ 5 Figure 1 2 1 Figure 1 2 2 Figure 1 2 3 2 FORM FRAME BORDER A form with black border will be shown As Figure 1 2 3 the small form in the center 7 LinuxDA API User Manual has border 3 FORM DLGFRAME When this style is given to a form the form caption will show as Figure 1 2 2 The caption rectangle where Message show is as wide as the form width 4 FORM SAVEBEHIND Save the background while a new FORM is created and its background will be restored if function CloseForm is invoked Recommend not to set a form to this style unless it is necessary for instance to show such a form as the messagebox as Figure 1 2 2 shown Caution DO NOT Forget to invoke CloseForm before creating another FORM if the form has style FORM SAVEBEHIND otherwise the memory that the saved background image occupied will not free and it may cause error There is another way to fulfill the same effect as SAVE BEHIND You can apply a block of memory and use the pair functions CopyScreen and PasteScreen Use CopyScreen to save the background into the memory let PasteScreen to recover the background and free the memory This is a safer way than using style SAVE BEHIND If you set the style to zero th
43. enu void XorButtonFace RECT r Use this function to inverse the rectangular region Function GetSelectedComponentld will invoke it Sample Code RECT g_rectPreviousHighLight static void HighLightApplication U8 cusComponentID int nIndex RECT rectLabel According ID to get the form index ID nIndex GetIndexFromId amp frmAppCategory cusComponentID According to index to get location of Label rectLabel left frmAppCategory nIndex x 1 49 LinuxDA API User Manual rectLabel top frmAppCategory nIndex y rectLabel right rectLabel left frmAppCategory nIndex w rectLabel bottom rectLabel top frmAppCategory nIndex h reverse the color Black to white White to blank XorButtonFace rectLabel store the location for highlight Label g_rectPreviousHighLight rectLabel static short max short x1 short x2 hehe P return the bigger value static U8 LoopTillPenUp RECT r A empty message loop but I fell this method is so mesh I will increase it soon static U16 isSystemRegion PIXEL px To check if the pixel in a system region Function GetSelectedComponentld will invoke it 6 Message Queue Definitions and Related Function Events definitions in gui h 3K 3K 3K 3e 3K 3K 3K 3e ee define the events of internal message queue here Mac Tseng 11 2 2000 CS R R define EVEN
44. erase the graphics the background will be damaged in this case you can use the fuction to avoid this problem Use this fuction to draw line is low efficient I recommend not to use it as possible as you can Sample Code see PixelInRect void draw ellipse short x short y short a short b GraphicsContext gc Draw a ellipse or a circle whose center point is x y And is the long axis b is the short axis The member of color in is used as the color of the ellipse s border and member fill index and mode is N A Sample Code see void draw pixel U16 x U16 y U8 color void bitblt short src x short src y short w short h short dest x short dest y U8 src short src units per line 8 dest short dest units per line GraphicsContext gc Remember the function bitblt in windows SDK This function can copy paste image between screen and memory even if both the source and target bitmaps are in memory In this funciton member color of is NOUSED Src x sre y w h the region of source image x dest y the left top corner of destination image SIC Source image pointer dest Destination image pointer Src units per line To indicate how many units will be used in one line For current LCD screen this value must be 20 because the screen width is 160 Dest units per line To indicate how many units will be used in one line For current LCD screen this value must be 20 because
45. erty of DB 3K gt K gt K gt K define DB_RECORD_BUSY 0x01 define DB_RECORD_SECURITY 0x02 define DB_RECORD_DELETED 0x04 define DB_RECORD_UPDATED 0x08 define DB CATEGORY ALL 0 10 define DB SHOW SECURITY 0x00 57 LinuxDA API User Manual define DB HIDE SECURITY 0x02 78 FR FR AR Definitions of Error Numbers of DB gt K define ERROR OPENDATABASE 1 define DB ERROR CLOSEDATABASE 1 define ERROR READDATABASE 1002 define DB ERROR WRITEDATABASE 1003 define DB ERROR CREATEDATABASE 1004 define DB ERROR DELETEDATABASE 1005 define DB ERROR NOERROR 0 define DB ERROR ADDCATEGORY 1006 define DB ERROR DELETECATEGORY 1007 define ERROR UPDATECATEGORY 1008 define DB ERROR GETCATEGORY 1009 define DB ERROR SETDBCATEGORY 1010 define DB ERROR ALLOCATEMEMORY 1011 define DB ERROR ADDRECORD 1012 define DB ERROR DELETERECORD 1013 define DB ERROR UPDATERECORD 1014 define DB ERROR GETRECORD 1015 CreateDatebase flags 2 KK define DB SET OVERWRITE 0x10 define DB SET NO FIELDHEAD 0x20 define DB BLOCK NONE 0 define DB BLOCK 16 define DB BLOCK 32 define DB BLOCK 64 define DB BLOCK 128 define BLOCK 256 define DB BLOCK 512 D I A 58 LinuxDA API User Manual define DB BLOCK 1024 10 typedef struct char fiel
46. functions such as LDAGetRecord And if you use this funtion and set the secu option is DB SHOW SECURITY you can get all records Sample Code see long LDAGetRecordNumber DBHANDLE fdidx long LDAGetRecordNumber DBHANDLE fdidx Get the number of the record whose category is the current category Sample Code include mini db h typedef struct char last_name 25 char first name 25 JADDRESS Correspond to the DBFIELD struct in function 1 static void GetRecordCount void short i db handle ADDRESS 2 long num1 num total strcpy rec1 last name Johns strcpy rec1 first name Smith strcpy rec2 last name Philips strcpy recl first name Adams g db handle LDAOpenDB address 0 if g db handle 1 open database sucessfully cate indexIZLDAAddDBCategory g db handle Personal cate index2 LDAAddDBcCategory g db handle Business 63 LinuxDA API User Manual normal record LDAAddRecord g db handle amp recl cate index1 DB SHOW protected record LDAAddRecord g db handle amp rec2 cate index2 DB RECORD SECURITY set the database to protected mode LDASetDBSecurity g db handle DB HIDE SECURITY LDASetDBCategory g db handle cate index1 There is one record in Personal catalog num1 1 num1 LDAGetRecordNumber g db handle LDASetDBCategory g db handle cate index2 There is one record in Business catalog It is protected so num2 0 num2 LDAGetR
47. he IRDA port according to the size you want Return the size if success return 1 if timed out short WriteIRDA void data long size Send data to the IRDA port according to the size you want Return the size if success return 1 if timed out Sample code Suggestion Call OpenIRDA at the beginning of your main function and CloseIRDA at the end of it void sendbyIrda ADDRESS rec short state sendtry 0 background U8 MallocScreen 160 160 CopyScreen background 0 0 160 160 CreateForm frmBeam state WriteIRDA rec sizeof ADDRESS while state lt 0 sendtry if sendtry gt 5 break state WriteIRDA rec sizeof ADDRESS_T if state lt 0 MsgBox IRDA_SEND_FAILS FRM_IRDA_SEND MB_OK else MsgBox IRDA SEND SUCCESS FRM IRDA SEND MB OK CloseForm frmBeam PasteScreen background 0 0 160 160 FreeScreen background 39 LinuxDA API User Manual void recvbyIrda ADDRESST RecvRec short status status ReadIRDA RecvRec sizeof ADDRESS T if status sizeof ADDRESS strcpy message strcat message RecvRec last name strcat message RecvRec first name answer MsgBox message FRM IRDA RECEIVE MB YESNO if answer MB_YES LDAAddRecord g_db_handle RecvRec 0 0 short GetRegister U32 reg void data short size Get the data in the specified register The parameter reg represents the register and the data is the data in this register The parameter siz
48. hort year short short mday This function will generate a form which shows a calendar to choose a day as Figure 2 1 1 shown The three parametres will give the date value which you choose in the calendar Caution The data type of Parameters is short not int While the data type of time fields in structure tm is int Remember to convert their types before you using this function Returns 0 when you click Cancel Ok button to return Keycode KEY ENTER KEY RETURN when you click especial keys Enter and Return touch screen or hardware key Figure 2 1 1 This function is included in a separated lib of date o If you want to call this function you MUST add this lib to the Makefile file In gui settime o void gui settime time t time set This function will generate a form as Figure 2 1 2 shown You can set time in your application in this form The parameter time set is time you bring to this functions and it will be displayed when the form is created After setting time the time value returned is in time set This function return the keycode value if you click RETURN key to return 67 LinuxDA API User Manual Figure 2 1 2 68 LinuxDA API User Manual 9 Standard Linux Lib Functions This section provides some useful standard linux lib functions 1 time 1 time 1 1 Fundmental definations struct tm a broken down time int tm sec seconds after the minute Normally
49. igned long U32 typedef struct define a pixel x y is co ordinates of the pixel short x short y PIXEL typedef struct short left the x coordinate of the start point 3 LinuxDA API User Manual short top y coordinate of the start point short right the x coordinate of the end point short bottom the y coordinate of the end point RECT 2 FORM Data Structure These data structure are defined in gui h typedef struct U8 type component types U8 id the component id when some component is clicked the id will be returned U16 x y w h is the left top corner co ordinates of the component and w is width h is height void text pointer may have different meaning U8 style special styles U8 status the component is visible or invisible U8 font each component has its own font Now there are three types of fonts small medium and large Recommend to use small fonts because the screen size hs rather small The definitions of the font style are list below FORM font types definition define FONT_SYS 0 define FONT_SMALL 0 define FONT_MEDIUM 1 define FONT_LARGE 2 Field descriptions Type Component type Id Each component in a form has it s own id When some component is clicked the id will be returned X y w d The co ordinates of each component the value x y is related to the left top corner of it s own form They ar
50. ionY U8 pcusScreen GraphicsContext gc gc color GUI BLACK gc mode Mode SRC gc fill index BlackPattern pcusScreen GetScreenPtr bitblt O 0 BITMAP_WIDTH BITMAP_HEIGHT sPositionX sPositionY pcBitmapData BITMAP WIDTH 8 pcusScreen 20 amp gc 8 GetScreenHeight void Get the screen height Use this type of function can make a program more portable Sample Code see PixelInRect U8 GetScreenWidth void Get the screen width Sample Code see PixelInRect Void SetAvailableRegion RECT r Specify some region in the screen to be available for some operations like drawing For instance you are going to draw in a special region then you need use the function to specify the region Caution Make sure that you have recover this setting by specify the region rectangle to the whole screen now it is 0 0 159 159 when finished or it will affect other forms to display Sample Code This program demos SetAvailableRegion API Define a square The center point is the center of the screen Its length is 20 pixels Draw a lines from left hand upper corner to right hand button corner Because the program reset the screen available region so it can draw the line within the available area Don t forget to to reset the screen size when the program exit static sample_play28 23 LinuxDA API User Manual RECT temp temp leftzGetScreenWidth 2 10 temp right GetScreenWidth 2
51. le in the introduction of FORM MENUITEM FORM MENUITEM The items are shown in the rectangle the menu is click the Digitizer and Exit are two menu items in Figure 1 2 5 type set to FORM MENUITEM id can be set a value as you want to but remember not same as the other components id X Y W h w h is not available of these are calculated by GUI text point to a string which will be shown on the menuitem when the menu is pulled down style commonly set to 0 for there is no style for it status usually COMPONENT VISIBLE font with which font to show the menuitem s text Usually we use FONT MEDIUM Caution if you want the menu items show in a menu you must let these menuitems follow the menu immediately The FORM MENU and FORM MENUITEM in Figure 1 2 5 are defined in the form definition as below FORM frm FORM MENU 10 5 20 0 0 Tools 0 COMPONENT VISIBLE FONT SMALL FORM MENUITEM 11 0 0 0 0 Digitizer 0 COMPONENT VISIBLE FONT SMALL FORM MENUITEM 12 0 0 0 0 Exit 0 COMPONENT VISIBLE FONT SMALL LinuxDA API User Manual FORM BUTTON Itis a very common component and you may often use Now there are only the standard rectangle buttons that the face of it is a string type set to FORM BUTTON id x y w h all are available text point to a string which will be shown on the button style
52. ll of these fields are calculated by GUI although you can set the value of these fields they will NOT take effect while these items are shown COZ these fields are overlay by GUI at that time If u want to define some sub menu items of one menu u MUST place these sub menu item definitions after its parent menu Maybe it s the most complex and most powerful component in our GUI First of all we can use this item to display a uncompressed bitmap in our UI Please notice the field text it s NOT a true text string pointer now it s the pointer of a structure BITMAP The definition of BITMAP is Typedef struct short width height void img char caption this structure field width and height are the size of bitmap image and the pointer img points to the data of the bitmap field caption is not always useful sometime when we need to display a bitmap with a string the field becomes useful The other way have you thought about an Owner draw component Maybe you hate the standard components Do you feel them ugly and want to draw one yourself If yes you can use this component to reach your target Because the GUI do noting while the pen click in u can use the returned message to do everything you want for example the event responses function Anyway u can use this kind of component to create your own button the check button the radio button the spin button the scroll bar even
53. max items the list can have short selected which item is current selected It counts form 0 and it is decided by the location of the item and not the item index short drop down width drop down height the listbox size when it drops down ITEM items refer to the above structure JCOMBOBOX style Four style you can choose to show the component COMOBOX NO BORDER Remove the border mad up of broken lines of the ComboBox COMBOBOX LEFT ALIGN Let the string in the Combobox be shown next to its left border and the arrow also in the left COMBOBOX RIGHT ALIGN Let the string in the Combobox be shown next to its right border and the arrow also in the right COMBOBOX NO ARROW Remove the arrow status set it invisible or visible font which font you use to show the items of the ComboBox The FORM COMBOBOX in Figure 1 2 6 is defined in the form definition as below ITEM items 0 Basic 1 Scientific 2 Financial 3 Exit COMBOBOX combobox 10 0 40 60 items FORM COMBOBOX 60 120 3 40 60 amp combobox 0 COMPONENT VISIBLE FONT SMALL LinuxDA API User Manual FORM TEXTBOX Textbox is a component can hold the content user inputs Since its content and then its size frequently changed its refreshing procedure shows some intricacy When textboxes are used in a form combined with other components an inattention will make the form disarray A textbox can be line
54. message whose keycode is as same as the one follows the case will be neglected void EnableSysHardwarekb U8 kc Enable a hardware key after it is disabled In msgbox h short MsgBox char msgstr char title short mode This function can display a form which shows a message in the center The form is made up of a caption shown in the left top corner a message string and one or two buttons These contents are controlled by the three parameters msgstr The message shown in the center of the form title The caption mode what type the buttons is which is used to close form and return a value There are three styles you can choose from MB OKCANCEL MB YESNO Each type of buttons the mode defined as follows MB OKCANCEL Ok MB YESNO Yes OK The function return a value decided by which button the user clicks It can be MB OK CANCEL YES MB NO This form neglects the key RETURN Sample Code int g nModified void SaveConfirm void short sAnswer if g nModified sAnswer MsgBox Do you want to Save it LinuxDA MB YESNO switch sAnswer case YES SaveProcess CloseProcess LinuxDA API User Manual break case MB NO CloseProcess break else CloseProcess In get msg h void GetMessage FORM frm GUI MSG msg YES It s the most important function to get the message queue Frm The
55. oop Exit the program close the windos restore the screen and release the memory static void Sample void U8 background momery block to save background background MallocScreen 160 160 CopyScreen background 0 0 160 160 CreateForm sample wait loop CloseForm sample PasteScreen background 0 0 160 160 FreeScreen background js U8 FreeScreen U8 p Free memory block Sample Code see U8 MallocScreen U16 w U16 h void CreateForm FORM dlg Only display a form For the details of FORM pls review FORM data structure Sample Code see U8 MallocScreen U16 w U16 h void CloseForm FORM dlg 28 LinuxDA API User Manual close the current form Sample Code see U8 MallocScreen U16 w U16 h void HideComponent short index FORM frm Let a component invisible A componet can not fire any message When it is hidden The first argument index is the sequential index of the component related to form caption Second FORM frm point to the address of the form the component in Sample Code This program demos the following APIs HideComponent gt ShowComponent Hide the object and display the hidden object void sample play26 short idx idx2GetIndexFromId sample eBUTTON SHOW HideComponent idx sample Delay ShowComponent idx sample void ShowComponent short index FORM frm Make a invisible component visible The two arguments are as same
56. r pixels will be occupied Pxs is the number of the pixels and the function return the number of bytes Sample Code see void bitblt short src x short src y short w short h short dest x short dest y U8 src short src units per line U8 dest short dest units per line GraphicsContext gc void patternfill short dest x short dest y short w short h U8 dest short dest units per line GraphicsContext gc 26 LinuxDA API User Manual Use a pre defined pattern to fill the given rectangular region about structure GraphicsContext please see function bitblt In member color is NOUSED this time This function will use member index as fill pattern and mode as fill mode But strongly recommend to use function FillRect instead of using this function COZ function FillRect is power enough Sample Code void FillPatternDemo void GraphicsContext gc U8 pcusScreen pcusScreen GetScreenPtr gc mode Mode SRC gc fill index DarkGreyPattern patternfill 16 120 24 24 pcusScreen GetScreenWidth 8 amp gc void FillRect RECT r GraphicsContext gc Use the given GraphicsContext to fill a rectangle region About GraphicsContext please see function bitblt Member color of is NOUSED here Sample Code see PixelInRect void draw rect RECT r GraphicsContext gc Only draw the outline of a rectangle region by using member color of
57. ry LDAAddDBCategory g db handle Personal LDACloseDB g db handle DB READ ONLY int LDAAddDBCategory DBHANDLE fdidx char cate name Add a category to the database The function returns the category ID in the database Category is a especial field named Category and defined by system and you need not define it in DBFIELD You can edit category by API such as add delete update a category Every record in DB belongs to a category database can hold 16 kinds of category Sample Code see int LDACreateDB char DBName short DBFlags DBFIELD dbField short dbFieldNumber int LDADeleteDBCategory DBHANDLE fdidx int cate index Delete a category of the database which handle is fdidx If a category existing in the database is deleted the category all records belonging to it will be updated to 0 by system Sample Code include mini db h static void DeleteCategory void intg db handle int cate index g db handle LDAOpenDB address 0 if g db handle 1 open database sucessfully 60 LinuxDA API User Manual cate_index LDAAddDBCategory g_db_handle Personal Record the Category ID of personal LDADeleteDBCategory g db handle cate index LDACloseDB g_db_handle 0 int LDAUpdateDBCategory DBHANDLE fdidx int cate index char cate name Update a category name Cate index is the ID of the category Sample Code include mini db h static void UpdateCategory void db handl
58. se screen void Release the screen related devices These above two functions is so low level that applications needs not to invoke them Sample Code see void init screen void void ClearMessageQueue void Clear the message queue It is usual to clear the message queue when a new form is created You must get messages from message queue before processing events Sample Code 20 LinuxDA API User Manual This program demos the following ClearMessageQueue GetMessage gt hibyte gt lobyte DefaultMessageRoutine his is the main program It clears the message queue first then go into the main loop program In the main loop it get all the messages from GetMessage It depends what message It takes different actions hibyte and lobyte for msg IParam to get the high 8 bits and low bits If program get some messages it won t process It will pass it to DefaultMessageRoutine It will pass the message to system message queue static void wait loop U8 loopFlag 1 PIXEL px GUI_MSG msg short i 0 ClearMessageQueue while loopFlag GetMessage sample amp msg px x hibyte msg IParam px y lobyte msg IParam switch msg event case EVENT CLICK switch msg id case MENUITEM MAIN EXIT loopFlag 0 break case BUTTON_MAIN_PLAY sample action BUTTON MAIN PLAY is pressed sample play20 will send a message It will add to the message queue sample play20 case MENUIT
59. t understand what the meaning is of this member set it to 0 and then the system will give a default value RECT first second third last button system used Application programmer need not care about them style should be HSCROLLBAR or VSCROLLBAR status simply set it to visible or invisible font Not valid The FORM SCROLLBAR in Figure 1 2 6 is defined in the form definition as below SCROLLBAR scollbar 10 0 20 FORM SCROLLBAR 50 140 5 5 40 amp scollbarrBSCOLLBAR COMPONENT VISIBLE FONT 5 MALL FORM_COMBOBOX A combobox is somewhat like the component menu which also has a couple of items It displays currently selected item The list box is popped when the combobox is clicked and invoked If an item is selected from the list the popup will be closed and the selected item will be reflected in the combobox When the items are larger than the domain of list a spinbutton can be added automatically for scrolling the items As the Figure 1 2 6 shown when click the Basic combobox a list including some string items will be shown type FORM_COMBOBOX id set a value X y w h they are all available LinuxDA API User Manual Figure 1 2 6 text point to the below COMBOBOX structure typedef struct short index you can sort the items when shown by this field charstr 32 the text of the item ITEM typedef struct short max items the
60. textbox Content 3 abcdefg n12345678 nhijkimn 250 3 0 9 static FORM frmMainFrame FORM CAPTION 0 O 0 SCREEN WIDTH SCREEN HEIGHT amp cusFormCaption_MainFrame FORM FRAME CAPTION COMPONENT VISIBLE FONT SMALL FORM TEXTBOX TEXTBOX CONTENT ID 20 20 100 60 amp textbox Content 0 COMPONENT VISIBLE FONT SMALL FORM END void RefreshDemo void 33 LinuxDA API User Manual int nIndex According ID to get the form index ID for TextBox nIndex GetIndexFromId frmMainFrame TEXTBOX CONTENT ID Update attribute for TextBox textbox Content string 0 A textbox Content string 1 B textbox Content string 2 textbox Content string 6 Z refresh the text box and get the line number for TextBox object system use only if the last paramater is 0 it won t refesh the object It get the line number for TextBox only RefreshTextBoxContents amp frmMainFrame nIndex 0 7 1 void SetTextBox Text FORM txt char s Change the textbox content to the string which s point to and display it immediately The argument txt point to the FORM structure which represents the textbox not the whole form Sample Code void SetTextBoxTextDemo char szContent int nIndex get ID get form index id for TextBox nIndex GetIndexFromId frmMainFrame ID Update Attribute for TextBox SetTextBoxText amp frmM
61. the high byte or the low byte of a 16 bit value Sample Code U8 lobyte U16 IParam In U16 GetStringWidth char str Return the current font width Sample Code define MAP WIDTH 150 define MAP HEIGHT 110 void ShowWelcome char szWelcomelnfo int nPositionX int nPositionY GraphicsContext gc Display the Welcome Information 43 LinuxDA API User Manual gc color GUI BLACK gc mode Mode SRC gc fill index WhitePattern nPositionX MAP WIDTH GetStringWidth szWelcomelnfo FONT SMALL 2 nPositionY HEIGHT 2 do drawString nPositionX nPositionY szWelcomelInfo amp gc FONT SMALL 016 GetFontHeight void Return the current font height Sample Code static void ShowFontInfo short nIndex short sFontHeight char szMessage 32 SetFont FONT SYS sFontHeight GetFontHeight sprintf szMessage System Font Height d sFontHeight MsgBox szMessage LinuxDA MB OK void SetFont Short font lib Sets default font Now it can only be set to 1 Sample Code see U16 GetFontHeight void void do drawString int x int y char data GraphicsContext gc short font lib Display the specified string in the given location and given fonts That means you can choose the font of the string by the last parameter and the default font library is set at the same time Sample Code see U16 GetStringWidth char str void DrawStringInRect RECT
62. the screen width is 160 gc The structure of the fill pattern and the copy method such as only simply paste the destination area or the source image can be XOR the destination area while it paste The structure GraphicsContext is defined in gui h typedef struct Color color CopyMode mode PatternIndex fill index GraphicsContext typedef enum GUI WHITE 0 GUI BLACK 1 Color typedef enum Mode_SRC Mode NOT SRC Mode SRC OR DST 25 LinuxDA API User Manual Mode SRC AND DST Mode SRC XOR DST Mode SRC OR NOT DST Mode SRC AND NOT DST Mode SRC XOR NOT DST Mode NOT SRC OR DST Mode NOT SRC AND DST Mode NOT SRC XOR DST Mode NOT SRC OR NOT DST Mode NOT SRC AND NOT DST Mode NOT SRC XOR NOT DST InvalidMode CopyMode typedef enum WhitePattern 0 BlackPattern DarkGreyPattern LightGreyPattern MicroPengPattern InvalidPattern PatternIndex Sample Code This program demos the following APIs bitblt and PixelsUnits Show a bitmap image void sample play24 short idx GraphicsContext gc idx2GetIndexFromId sample e BUTTON SHOW BITMAP gc color GUI BLACK gc mode Mode SRC gc fill index WhitePattern bitblt 0 0 smilie oops bmp width smilie oops bmp height sample idx x4 1 sample idx y 1 smi lie oops bmp img PixelsUnits smilie oops bmp width GetScreenPtr 20 amp gc U8 PixelsUnits short Get how many bytes a certain numbe
63. tion needs to use the low level message queue Because the low level message queue only returns a simple structure it s not enough to deal with the events of UI user interface The mostly job of message queue is done by GUI So I call this as high level message queue the low level message queue typedef struct U16 x U16 y U16 event 8 MESSAGE the high level message queue typedef struct U8 id U16 event the type of the event U32 IParam a long parameter which can return different value according to 51 LinuxDA API User Manual different conditions such as coordinates U8 keycode the value returned when you press some hardware button on the shell of your PDA machine Next you will find a list definitions that indicates what will be returned to every key on PDA short value It has different use to different components or events For SPINBUTTON it will be 1 or 1 when the up or down arrow is clicked for EVENT INPUTCHAR it will be the amount of lines discrepancy about the textbox MSG The Procomp PDA keycode There are five hardware buttons on the Cellvic machine and the keycode of these buttons are defined as below define KEY POWER define KEY RIGHT define KEY UP define KEY DOWN define KEY ENTER define KEY LEFT define KEY RETURN define KEY KEYBOARD define KEY LIGHT define KEY ADDRESS 10 define KEY CALCULATOR 11 define KEY CLOCK 12 00 10 LN
64. ue of message returned will be 1 or 1 The FORM_SPINBUTTON in Figure 1 2 6 is defined in the form definition as below SPINBUTTON spinbutton 15 5 FORM SPINBUTTON 10 90 30 20 15 amp spinbuttonXHSPINBUTTON COMPONENT VISIBLE FO NT SMALL FORM SCROLLBAR There are two types of the SCOLLBAR one is vertical scrollbar the other is Horizontal scrollbar As the image in the right of Figure 1 2 6 shown a scroll bar includes two arrows and one page It can store the position of this page The Related macros in gui h define VSCROLLBAR 0 define HSCROLLBAR 1 type SCROLLBAR id x y give values as you want to W for Vertical SCROLLBAR this member is NOTUSED because system will be set it to 7 h for Horizontal SCROLLBAR this member is NOTUSED because system will be 13 LinuxDA API User Manual set it to 7 text the pointer of a structure SCROLLBAR which is defined in gui h typedef struct short max position page height max The maximum times the bar can scroll and it is not the max of pixel number It set the limitation that the position can changed Position The current position of the bar It can changed in the range form 0 to max 1 Page height It means the amount that the variable position will be added or subtracted when the page scrolls down or up If you set this value greater than max the system will adjust it to a suitable value If you really don
65. ultiple lines Each line is separated by n status set it invisible or visible font which font you use to show the label The FORM LABEL in Figure 1 2 4 is defined in the form definition as below FORM LABEL 10 5 5 30 15 Last Name X ALIGN RIGHTIY ALIGN CENTER COMPONENT VISIBLE FONT SMALL FORM LABEL 20 5 25 30 15 First Name X ALIGN RIGHTIY ALIGN CENTER COMPONENT VISIBLE FONT SMALL FORM MENU Shown in the top of the form A menubar is commonly hidden unless you either click the region which the menu will next be shown in This region may be superposed by the caption of the form or press the hardware button which is designed to invoke the showing of the menu Tools in the Figure 1 2 4 is a menu in the top menu bar The event EVENT SHOW MENUBAR will be returned when the menubar is shown And The event EVENT HIDE MENUBAR will be cause when the menubar is hidden Figure 1 2 5 LinuxDA API User Manual type set to FORM MENU id can be set a value as you want to x y w h x y as usual but the w h is invalid GUI will calculate the width and the height automatically and any values given will take no effect text point to a text string which will be shown on the menu style commonly set to 0 status set it to invisible or visible font which font to show the menu s text Usually we use FONT MEDIUM You can refer to its usage in the followed examp
Download Pdf Manuals
Related Search
Related Contents
MANUALE DI ISTRUZIONI douai ma ville 04/07/2015 ACTIVE CUBE - Bonfiglioli Caro consumidor, ficamos muito satisfeitos por você ter Mode d`emploi chaudière - 1,46 MB ROWNTREE, 1997, Les cartes mentales 1 - Ina Moi, les autres: J` ai un problème Copyright © All rights reserved.
Failed to retrieve file