Difference between revisions of "83Plus:OS:Dialog context"
Line 2: | Line 2: | ||
This Documentation is for use with the [[:Category:83Plus:BCALLs:By_Name:Dialog|Dialog BCALLS]] | This Documentation is for use with the [[:Category:83Plus:BCALLs:By_Name:Dialog|Dialog BCALLS]] | ||
+ | == General Info == | ||
To start this context, load a menu structure* to ramCode, BCALL DialogInit and then BCALL StartDialog. | To start this context, load a menu structure* to ramCode, BCALL DialogInit and then BCALL StartDialog. | ||
You choose whether the run indicator is displayed and whether contexts are allowed (appAllowContext,(iy+appFlags)). | You choose whether the run indicator is displayed and whether contexts are allowed (appAllowContext,(iy+appFlags)). | ||
Line 73: | Line 74: | ||
bNumIndex above is an offset into a list of floating-point numbers: | bNumIndex above is an offset into a list of floating-point numbers: | ||
DB 00h,80h,00h,00h,00h,00h,00h,00h,00h | DB 00h,80h,00h,00h,00h,00h,00h,00h,00h | ||
+ | == Example == | ||
+ | hookBackup equ appBackUpScreen | ||
+ | .db 0BBh,6Dh | ||
+ | ld hl,rawKeyHookPtr | ||
+ | ld de,hookBackup | ||
+ | ld bc,4 | ||
+ | ldir | ||
+ | ld a,(flags+34h) | ||
+ | ld (de),a | ||
+ | ld a,(cxCurApp) | ||
+ | push af | ||
+ | ld a,58h | ||
+ | ld (cxCurApp),a | ||
+ | ld hl,structStart | ||
+ | ld de,ramCode | ||
+ | ld bc,structEnd-structStart | ||
+ | ldir | ||
+ | ld hl,dialogCallback | ||
+ | in a,(6) | ||
+ | bcall(_DialogInit) | ||
+ | bcall(_runIndicOff) | ||
+ | bcall(_StartDialog) | ||
+ | bcall(_cursorOff) | ||
+ | bcall(_clrLCDFull) | ||
+ | res appCurWord,(iy+appFlags) | ||
+ | bcall(_ClrTxtShd) | ||
+ | ld hl,cmdShadow | ||
+ | ld de,cmdShadow+1 | ||
+ | ld (hl),' ' | ||
+ | ld bc,127 | ||
+ | ldir | ||
+ | pop af | ||
+ | ld (cxCurApp),a | ||
+ | ld hl,hookBackup | ||
+ | ld de,rawKeyHookPtr | ||
+ | ld bc,4 | ||
+ | ldir | ||
+ | ld a,(hl) | ||
+ | ld (flags+34h),a | ||
+ | xor a | ||
+ | bcall(_GetDialogNumOP1) | ||
+ | ld hl,0 | ||
+ | ld (penCol),hl | ||
+ | ld a,9 | ||
+ | bcall(_DispOP1a) | ||
+ | dialogCallback: | ||
+ | xor a | ||
+ | ret | ||
+ | structStart: | ||
+ | ;put your dialog data here | ||
+ | structEnd: |
Revision as of 17:37, 12 April 2008
This Documentation is for use with the Dialog BCALLS
General Info
To start this context, load a menu structure* to ramCode, BCALL DialogInit and then BCALL StartDialog. You choose whether the run indicator is displayed and whether contexts are allowed (appAllowContext,(iy+appFlags)). It is imperative that (cxCurApp) be one of the allowed values (use 58h=kExtApps).
If kSolveRoot (SOLVE EDITOR), kStatEd (list editor), or kInfStat (inferential statistic editor) are pressed, the entire screen is redrawn and then the parser callback is called with A=1.
If [UP], [DOWN], or [ENTER] are pressed, any entered number is parsed*.
If [2nd]+[QUIT] is pressed, whatever has been entered will be parsed* (no errors thrown nor anything displayed) to OP1, the previous context vectors are restored, SP is restored from (spSave), and the run indicator is turned off.
Parsing the number
ParseInp is called on the data entered, and OP1 is checked to make sure it is REAL (error thrown if not (and this may return to the edit)). A=0 is passed to the parser callback. B (8006h) is the index into a prompt structure (probably bID = 3). It is expected to return a value in A. Return zero to display the current line (string and number). It also copies the number in OP1 to the spot bNumIndex points to. If 0,(iy+2Eh) is set, the rest of the line is not erased (then NewLine).
Menu structure
Load as many of these structures, one after the other (zero-terminated), to ramCode in the order you want it displayed. Store the length-indexed strings in RAM as well (right after this structure, in ramCode).
bID can be from 1-6: bID = 1: display string (cannot select). bID = 2: display highlightable choices (as in the MODE context). A byte table at 8009h has to do with what is selected here. bID = 3: display prompt string and number. bID = 4: display highlightable string. bID = 5: display menu number (ex. "1:") and prompt string. bID = 6: hidden, skip displaying this entry.
Prompt structure when bID = 1:
DB bID ; DB bNumChoices ;probably always 1 DB bUnknown ; DW wStringOffset ;offset from start of ramCode
Prompt structure when bID = 2:
DB bID ; DB bNumChoices ; DB bUnknown ;I think this is the number of rows to skip for next item, or something DW wStringOffset ;offset from start of ramCode /
DB bColumn ;column to display string (this is probably ignored) \ There are bNumChoices of these.
Prompt structure when bID = 3:
DB bID ; DB bNumChoices ;probably always 1 DB bNumIndex ; DW wStringOffset ;offset from start of ramCode
Prompt structure when bID = 4:
DB bID ; DB bNumChoices ;probably always 1 DB bUnknown ; DW wStringOffset ;offset from start of ramCode
Prompt structure when bID = 5: DB bID ;
DB bNumEntries ;probably always 1 DB bMenuItemNum ;1 for "1:", 2 for "2:", etc. DW wStringOffset ;offset from start of ramCode
Prompt structure when bID = 6:
DB bID ; DB bNumChoices ; DB bUnknown ; DW wStringOffset ;offset from start of ramCode < There are bNumChoices of these.
8038h: bNumIndex above is an offset into a list of floating-point numbers:
DB 00h,80h,00h,00h,00h,00h,00h,00h,00h
Example
hookBackup equ appBackUpScreen .db 0BBh,6Dh ld hl,rawKeyHookPtr ld de,hookBackup ld bc,4 ldir ld a,(flags+34h) ld (de),a ld a,(cxCurApp) push af ld a,58h ld (cxCurApp),a ld hl,structStart ld de,ramCode ld bc,structEnd-structStart ldir ld hl,dialogCallback in a,(6) bcall(_DialogInit) bcall(_runIndicOff) bcall(_StartDialog) bcall(_cursorOff) bcall(_clrLCDFull) res appCurWord,(iy+appFlags) bcall(_ClrTxtShd) ld hl,cmdShadow ld de,cmdShadow+1 ld (hl),' ' ld bc,127 ldir pop af ld (cxCurApp),a ld hl,hookBackup ld de,rawKeyHookPtr ld bc,4 ldir ld a,(hl) ld (flags+34h),a xor a bcall(_GetDialogNumOP1) ld hl,0 ld (penCol),hl ld a,9 bcall(_DispOP1a) dialogCallback: xor a ret structStart: ;put your dialog data here structEnd: