Author Topic: DDgui_msg  (Read 3236 times)

MrTAToad

  • Guest
DDgui_msg
« on: 2008-Dec-21 »
I've improved this function somewhat, mainly due to the fact that the default colours for the window clashes with one of my fonts - white on white doesn't make text easy to ready :)

Code: (glbasic) [Select]
FUNCTION DDgui_msg: text$, yes_no%,title$="!?",cBright%=128,cNorm%=255
LOCAL scx%, scy%, width%
GETSCREENSIZE scx, scy
width = MAX(scx/3, 148)
DDgui_pushdialog((scx-width)/2, (scy)/4, width, 150)
DDgui_set("", "MOVEABLE", TRUE)
DDgui_set("", "TEXT", title$)
DDgui_set("","COL_BRIGHT",cBright%)
DDgui_set("","COL_NORM",cNorm%)

DDgui_widget("", text$, width-16,0)
DDgui_spacer(10000,5)
IF yes_no
DDgui_button("bt_yes", "Yes", 0,0)
DDgui_button("bt_no", "No", 0,0)
ELSE
DDgui_button("bt_yes", "OK", 0,0)
ENDIF
DDgui_resizedialog(0,0,0,0) // let everything arrange
WHILE TRUE
DDgui_show(FALSE)
SHOWSCREEN
IF DDgui_get("bt_yes", "CLICKED")
DDgui_popdialog()
RETURN 1
ENDIF
IF DDgui_get("bt_no", "CLICKED")
DDgui_popdialog()
RETURN 0
ENDIF
WEND
ENDFUNCTION

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10728
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: DDgui_msg
« Reply #1 on: 2008-Dec-22 »
Better make that MyDDgui_msg: and put it in your own source code.
If you're using a non readable font, try changing the colors with:
ddgui_set("", "COL_NORM", RGB...)
And "COl_BRIGHT", "COL_HOVER", "COL_HOVER_BRIGHT" IIRC. See the docs.

MrTAToad

  • Guest
Re: DDgui_msg
« Reply #2 on: 2008-Dec-22 »
Okay :)